#include <iostream> using namespace std; int main(void) { int n, i, c = 0; cin >> n; while (n-- > 0) { cin >> i; if (i == 1) c++; } cout << (c > 1 ? 0 : c == 1 ? 1 : 2) << endl << 2 << endl << 1 << ' ' << 2; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> using namespace std; int main(void) { int n, i, c = 0; cin >> n; while (n-- > 0) { cin >> i; if (i == 1) c++; } cout << (c > 1 ? 0 : c == 1 ? 1 : 2) << endl << 2 << endl << 1 << ' ' << 2; return 0; } |