#include<stdio.h> #include <algorithm> int main() { int n, t[1000004], res = 0; scanf("%d",&n); for (int i=0;i<n;i++) scanf("%d",&t[i]); int num = std::count(t,t+n, 1); if(num == 0) res= 2; else if(num==1) res = 1; printf("%d\n2\n1 2\n", res); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include<stdio.h> #include <algorithm> int main() { int n, t[1000004], res = 0; scanf("%d",&n); for (int i=0;i<n;i++) scanf("%d",&t[i]); int num = std::count(t,t+n, 1); if(num == 0) res= 2; else if(num==1) res = 1; printf("%d\n2\n1 2\n", res); } |