#include <iostream> int main() { int n; int* v; int one_count = 0; std::cin >> n; v = new int[n]; for(int i=0;i<n;i++) { std::cin >> v[i]; if(v[i]==1) one_count++; } if(one_count==0) std::cout << "2\n2\n1 2"; else if(one_count==1) std::cout << "1\n2\n1 2"; else 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 19 20 21 22 23 24 25 | #include <iostream> int main() { int n; int* v; int one_count = 0; std::cin >> n; v = new int[n]; for(int i=0;i<n;i++) { std::cin >> v[i]; if(v[i]==1) one_count++; } if(one_count==0) std::cout << "2\n2\n1 2"; else if(one_count==1) std::cout << "1\n2\n1 2"; else std::cout << "0\n2\n1 2"; return 0; } |