#include "bits/stdc++.h" using namespace std; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; int ones = 0; for (int i = 0; i < n; ++i) { int x; cin >> x; ones += (x == 1); } cout << max(2-ones,0) << "\n2\n1 2\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include "bits/stdc++.h" using namespace std; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; int ones = 0; for (int i = 0; i < n; ++i) { int x; cin >> x; ones += (x == 1); } cout << max(2-ones,0) << "\n2\n1 2\n"; } |