#include <cstdio> int main() { int n; std::scanf("%i", &n); int ones = 0; for (int i = 0; i < n; i++) { int a; scanf("%i", &a); if (a == 1) { ones++; if (ones == 2) break; } } switch (ones) { case 2: puts("0\n2"); puts("1 2"); break; case 1: puts("1\n2"); puts("1 2"); break; case 0: puts("2\n2"); puts("1 2"); break; } }
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 | #include <cstdio> int main() { int n; std::scanf("%i", &n); int ones = 0; for (int i = 0; i < n; i++) { int a; scanf("%i", &a); if (a == 1) { ones++; if (ones == 2) break; } } switch (ones) { case 2: puts("0\n2"); puts("1 2"); break; case 1: puts("1\n2"); puts("1 2"); break; case 0: puts("2\n2"); puts("1 2"); break; } } |