#include "stdio.h" int main(void) { int n; scanf("%d", &n); int a, ones = 0; for (int i = 0; i < n; i++) { scanf("%d", &a); if (a == 1) ones++; } if (ones > 1) printf("0\n2\n1 2"); else if (ones == 1) printf("1\n2\n1 2"); else printf("2\n2\n1 2"); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include "stdio.h" int main(void) { int n; scanf("%d", &n); int a, ones = 0; for (int i = 0; i < n; i++) { scanf("%d", &a); if (a == 1) ones++; } if (ones > 1) printf("0\n2\n1 2"); else if (ones == 1) printf("1\n2\n1 2"); else printf("2\n2\n1 2"); return 0; } |