#include <cstdio> using namespace std; int main() { int n, j=0, a; scanf("%d",&n); while(n--) { scanf("%d",&a); if (a == 1) j++; } if(j>2) j =2; printf("%d\n2\n1 2\n",2-j); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <cstdio> using namespace std; int main() { int n, j=0, a; scanf("%d",&n); while(n--) { scanf("%d",&a); if (a == 1) j++; } if(j>2) j =2; printf("%d\n2\n1 2\n",2-j); } |