#include <iostream> using namespace std; int n, a, b; int main() { scanf("%d", &n); b = 0; for (int i = 1; i <= n; i++) { scanf("%d", &a); if (a == 1)b++; } if (b >= 2)printf("0\n2\n1 2\n"); if (b == 1)printf("1\n2\n1 2\n"); if (b == 0)printf("2\n2\n1 2\n"); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> using namespace std; int n, a, b; int main() { scanf("%d", &n); b = 0; for (int i = 1; i <= n; i++) { scanf("%d", &a); if (a == 1)b++; } if (b >= 2)printf("0\n2\n1 2\n"); if (b == 1)printf("1\n2\n1 2\n"); if (b == 0)printf("2\n2\n1 2\n"); } |