#include <stdio.h> #include <iostream> #include <vector> int main() { int n; scanf("%u", &n); int ones = 0; for (int i = 0; i < n; ++i) { int rank; scanf("%u", &rank); if (rank == 1) ++ones; } if (ones > 1) ones = 2; printf("%u\n", 2 - ones); printf("2\n"); printf("1 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 | #include <stdio.h> #include <iostream> #include <vector> int main() { int n; scanf("%u", &n); int ones = 0; for (int i = 0; i < n; ++i) { int rank; scanf("%u", &rank); if (rank == 1) ++ones; } if (ones > 1) ones = 2; printf("%u\n", 2 - ones); printf("2\n"); printf("1 2\n"); return 0; } |