#include <stdio.h> using namespace std; int main(){ long long n; scanf("%lld", &n); long long vertex; long long totalOnes = 0; while (n--){ scanf("%lld", &vertex); if (vertex == 1){ totalOnes += 1; } } long long x; if (totalOnes>=2){ x = 0; } else { if (totalOnes==1) { x = 1; } else { x = 2; } } printf("%lld\n", x); printf("2 \n"); printf("1 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 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include <stdio.h> using namespace std; int main(){ long long n; scanf("%lld", &n); long long vertex; long long totalOnes = 0; while (n--){ scanf("%lld", &vertex); if (vertex == 1){ totalOnes += 1; } } long long x; if (totalOnes>=2){ x = 0; } else { if (totalOnes==1) { x = 1; } else { x = 2; } } printf("%lld\n", x); printf("2 \n"); printf("1 2\n"); return 0; } |