#include <cstdio> int main() { int n; scanf("%d",&n); int ones=0; for(int i=0;i<n;i++) { int a_i; scanf("%d", &a_i); if(a_i == 1) ones+=1; } if(ones == 0) printf("2\n2\n1 2\n"); else if(ones == 1) printf("1\n2\n1 2\n"); else printf("0\n2\n1 2\n"); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <cstdio> int main() { int n; scanf("%d",&n); int ones=0; for(int i=0;i<n;i++) { int a_i; scanf("%d", &a_i); if(a_i == 1) ones+=1; } if(ones == 0) printf("2\n2\n1 2\n"); else if(ones == 1) printf("1\n2\n1 2\n"); else printf("0\n2\n1 2\n"); return 0; } |