#include <iostream> int n; int main() { std::cin >> n; int ones = 0; for (int i=0;i<n;++i) { int K; std::cin >> K; if (K == 1) ones++; } int result = 0; if (ones >= 2) result = 0; else if (ones == 1) result = 1; else result = 2; std::cout << result << 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 22 23 24 25 | #include <iostream> int n; int main() { std::cin >> n; int ones = 0; for (int i=0;i<n;++i) { int K; std::cin >> K; if (K == 1) ones++; } int result = 0; if (ones >= 2) result = 0; else if (ones == 1) result = 1; else result = 2; std::cout << result << std::endl; std::cout << 2 << std::endl; std::cout << "1 2" << std::endl; return 0; } |