#include <iostream> #include <vector> int main () { int n, cnt = 0, x; std::cin >> n; while (n--) { std::cin >> x; if (x == 1) cnt++; } if (cnt >= 2) std::cout << 0 << std::endl; else if (cnt == 1) std::cout << 1 << std::endl; else if (cnt == 0) std::cout << 2 << std::endl; std::cout << 2 << std::endl; std::cout << "1 2" << std::endl; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <iostream> #include <vector> int main () { int n, cnt = 0, x; std::cin >> n; while (n--) { std::cin >> x; if (x == 1) cnt++; } if (cnt >= 2) std::cout << 0 << std::endl; else if (cnt == 1) std::cout << 1 << std::endl; else if (cnt == 0) std::cout << 2 << std::endl; std::cout << 2 << std::endl; std::cout << "1 2" << std::endl; return 0; } |