#include <cstdio> int main() { int number_of_ones = 0; int number_of_vert; scanf("%d", &number_of_vert); while(number_of_vert--) { int x; scanf("%d", &x); if(x == 1) { number_of_ones++; if(number_of_ones > 1) break; } } switch(number_of_ones) { case 0: printf("2\n"); break; case 1: printf("1\n"); break; default: printf("0\n"); } printf("2\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 23 | #include <cstdio> int main() { int number_of_ones = 0; int number_of_vert; scanf("%d", &number_of_vert); while(number_of_vert--) { int x; scanf("%d", &x); if(x == 1) { number_of_ones++; if(number_of_ones > 1) break; } } switch(number_of_ones) { case 0: printf("2\n"); break; case 1: printf("1\n"); break; default: printf("0\n"); } printf("2\n1 2\n"); return 0; } |