#include <cstdio> #include <algorithm> using namespace std; int main() { int n; scanf("%d", &n); int ones = 0; for (int i=0; i<n; ++i) { int x; scanf("%d", &x); if (x == 1) { ++ones; } } int result = max(0, 2 - ones); printf("%d\n", result); printf("%d\n", 2); printf("%d %d\n", 1, 2); 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 | #include <cstdio> #include <algorithm> using namespace std; int main() { int n; scanf("%d", &n); int ones = 0; for (int i=0; i<n; ++i) { int x; scanf("%d", &x); if (x == 1) { ++ones; } } int result = max(0, 2 - ones); printf("%d\n", result); printf("%d\n", 2); printf("%d %d\n", 1, 2); return 0; } |