#include <iostream> using namespace std; int main() { int n,x; cin >> n; int number_of_ones = 0; for (int i = 0; i < n; ++i) { cin >> x; number_of_ones += (x==1); } if (number_of_ones >= 2) number_of_ones = 2; cout << 2 - number_of_ones << "\n2\n1 2\n"; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <iostream> using namespace std; int main() { int n,x; cin >> n; int number_of_ones = 0; for (int i = 0; i < n; ++i) { cin >> x; number_of_ones += (x==1); } if (number_of_ones >= 2) number_of_ones = 2; cout << 2 - number_of_ones << "\n2\n1 2\n"; return 0; } |