#include <iostream> using namespace std; //Compiler version g++ 6.3.0 int main() { int n, k, l; l=0; cin >> n; while(n){ cin >> k; if(k==1){ l++; } n--; } if(l>1){ cout << "0" << endl << "2" << endl << "1 2"; } if(l==1){ cout << "1" << endl << "2" << endl << "1 2"; } if(l==0){ cout << "2" << endl << "2" << endl << "1 2"; } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #include <iostream> using namespace std; //Compiler version g++ 6.3.0 int main() { int n, k, l; l=0; cin >> n; while(n){ cin >> k; if(k==1){ l++; } n--; } if(l>1){ cout << "0" << endl << "2" << endl << "1 2"; } if(l==1){ cout << "1" << endl << "2" << endl << "1 2"; } if(l==0){ cout << "2" << endl << "2" << endl << "1 2"; } } |