#include <cstdio> using namespace std; int main(){ int n, a, cnt = 0; scanf("%d", &n); for(int i=0; i<n; i++){ scanf("%d", &a); if(a == 1) cnt++; } if(cnt >= 2) printf("0\n2\n1 2\n"); else if(cnt == 1) printf("1\n2\n1 2\n"); else printf("2\n2\n1 2\n"); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <cstdio> using namespace std; int main(){ int n, a, cnt = 0; scanf("%d", &n); for(int i=0; i<n; i++){ scanf("%d", &a); if(a == 1) cnt++; } if(cnt >= 2) printf("0\n2\n1 2\n"); else if(cnt == 1) printf("1\n2\n1 2\n"); else printf("2\n2\n1 2\n"); } |