#include <iostream>
using namespace std;
int main()
{
int x,y,z=0;
cin >> x;
for (x; x > 0; x--) {
cin >> y;
if (y == 1)z++;
}
if (z == 0) cout << "2" << endl << "2" << endl << "1 2";
else if (z == 1) cout << "1" << endl << "2" << endl << "1 2";
else cout << "0" << 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 20 | #include <iostream> using namespace std; int main() { int x,y,z=0; cin >> x; for (x; x > 0; x--) { cin >> y; if (y == 1)z++; } if (z == 0) cout << "2" << endl << "2" << endl << "1 2"; else if (z == 1) cout << "1" << endl << "2" << endl << "1 2"; else cout << "0" << endl << "2" << endl << "1 2"; return 0; } |
English