#include <iostream>
using namespace std;
int main() {
int top;
int quantityOf1 = 0;
int temp;
cin >> top;
for (int i=0; i < top; i++){
cin >> temp;
if(temp == 1)
quantityOf1 ++;
}
if (quantityOf1 > 1){
cout << "0" << endl;
} else if (quantityOf1 == 1){
cout << "1" << endl;
} else {
cout << "2" << endl;
}
cout << "2" << endl;
cout << "1 2";
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <iostream> using namespace std; int main() { int top; int quantityOf1 = 0; int temp; cin >> top; for (int i=0; i < top; i++){ cin >> temp; if(temp == 1) quantityOf1 ++; } if (quantityOf1 > 1){ cout << "0" << endl; } else if (quantityOf1 == 1){ cout << "1" << endl; } else { cout << "2" << endl; } cout << "2" << endl; cout << "1 2"; return 0; } |
English