#include <iostream> using namespace std; int main() { int n; cin >> ("%d", n); int tmp; int aa=0; for (int i=0; i<n; i++) { int tmp; cin >> ("%d", tmp); if (tmp == 1) { aa++; } } if (aa >= 2) { printf("0\n2\n1 2\n"); } else if (aa == 1) { printf("1\n2\n1 2\n"); } else { printf("2\n2\n1 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 30 31 32 33 34 35 36 | #include <iostream> using namespace std; int main() { int n; cin >> ("%d", n); int tmp; int aa=0; for (int i=0; i<n; i++) { int tmp; cin >> ("%d", tmp); if (tmp == 1) { aa++; } } if (aa >= 2) { printf("0\n2\n1 2\n"); } else if (aa == 1) { printf("1\n2\n1 2\n"); } else { printf("2\n2\n1 2\n"); } return 0; } |