#include <cstdio> #include <iostream> #include <vector> using namespace std; int main () { int n; scanf("%d", &n); int ile1 = 0; for (int i = 0; i < n; i++) { int x; scanf("%d", &x); if (x == 1) ile1++; } if (ile1 >= 2) { printf("0\n"); } else if (ile1 == 1) { printf("1\n"); } else { printf("2\n"); } printf("2\n"); printf("1 2\n"); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include <cstdio> #include <iostream> #include <vector> using namespace std; int main () { int n; scanf("%d", &n); int ile1 = 0; for (int i = 0; i < n; i++) { int x; scanf("%d", &x); if (x == 1) ile1++; } if (ile1 >= 2) { printf("0\n"); } else if (ile1 == 1) { printf("1\n"); } else { printf("2\n"); } printf("2\n"); printf("1 2\n"); return 0; } |