#include <iostream> using namespace std; int n, a, ones; int main () { cin >> n; for (int i=0; i<n; i++) { cin >> a; if (a == 1) ones++; } cout << max(0, 2 - ones) << endl << 2 << endl << "1 2" << endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <iostream> using namespace std; int n, a, ones; int main () { cin >> n; for (int i=0; i<n; i++) { cin >> a; if (a == 1) ones++; } cout << max(0, 2 - ones) << endl << 2 << endl << "1 2" << endl; } |