#include <algorithm> #include <iostream> #include <random> #include <vector> int main(int argc, char** argv) { uint32_t n = 0; std::cin >> n; uint32_t num_of_ones = 0; uint32_t tmp = 0; for (uint32_t idx = 0; idx < n; idx++) { std::cin >> tmp; if (tmp == 1) num_of_ones += 1; } if (num_of_ones >= 2) std::cout << "0" << std::endl; else if (num_of_ones == 1) std::cout << "1" << std::endl; else 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 22 23 24 25 | #include <algorithm> #include <iostream> #include <random> #include <vector> int main(int argc, char** argv) { uint32_t n = 0; std::cin >> n; uint32_t num_of_ones = 0; uint32_t tmp = 0; for (uint32_t idx = 0; idx < n; idx++) { std::cin >> tmp; if (tmp == 1) num_of_ones += 1; } if (num_of_ones >= 2) std::cout << "0" << std::endl; else if (num_of_ones == 1) std::cout << "1" << std::endl; else std::cout << "2" << std::endl; std::cout << "2" << std::endl; std::cout << "1 2" << std::endl; return 0; } |