#include <iostream> int main() { size_t n; std::cin >> n; size_t ones = 0; for (size_t i = 0; i < n; ++i) { size_t a; std::cin >> a; ones += a == 1 ? 1 : 0; } std::cout << 2 - std::min(ones, (size_t)2) << "\n2\n1 2\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <iostream> int main() { size_t n; std::cin >> n; size_t ones = 0; for (size_t i = 0; i < n; ++i) { size_t a; std::cin >> a; ones += a == 1 ? 1 : 0; } std::cout << 2 - std::min(ones, (size_t)2) << "\n2\n1 2\n"; } |