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