#include <iostream> #include <cstdio> #include <vector> using namespace std; int n, tab[1000100], one, wyn[10]; //*************************************************************************************** int main() { scanf("%d", &n); for(int i = 0; i < n; i++) { int a; scanf("%d", &a); if (a == 1) { if(one < 2) wyn[one] = i + 1; one++; } } if (one == 0) printf("2\n"); else if (one == 1) printf("1\n"); else printf("0\n"); printf("2\n1 2\n"); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <iostream> #include <cstdio> #include <vector> using namespace std; int n, tab[1000100], one, wyn[10]; //*************************************************************************************** int main() { scanf("%d", &n); for(int i = 0; i < n; i++) { int a; scanf("%d", &a); if (a == 1) { if(one < 2) wyn[one] = i + 1; one++; } } if (one == 0) printf("2\n"); else if (one == 1) printf("1\n"); else printf("0\n"); printf("2\n1 2\n"); } |