#include <iostream> int main() { int n; std::cin>>n; int num1=0; for(int i=0;i<n;++i) { int v; std::cin>>v; num1+=(v==1?1:0); } if(num1==0){std::cout<<"2\n2\n1 2";} else if(num1==1){std::cout<<"1\n2\n1 2";} else if(num1>=2){std::cout<<"0\n2\n1 2";} return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <iostream> int main() { int n; std::cin>>n; int num1=0; for(int i=0;i<n;++i) { int v; std::cin>>v; num1+=(v==1?1:0); } if(num1==0){std::cout<<"2\n2\n1 2";} else if(num1==1){std::cout<<"1\n2\n1 2";} else if(num1>=2){std::cout<<"0\n2\n1 2";} return 0; } |