#include <algorithm> #include <stdio.h> int main() { int n, tmp, onesCount = 0; scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%d", &tmp); if (tmp == 1) { onesCount++; } } printf("%d\n", std::max(2 - onesCount, 0)); 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 | #include <algorithm> #include <stdio.h> int main() { int n, tmp, onesCount = 0; scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%d", &tmp); if (tmp == 1) { onesCount++; } } printf("%d\n", std::max(2 - onesCount, 0)); printf("2\n"); printf("1 2\n"); return 0; } |