#include <bits/stdc++.h>
using namespace std;
int n;
int t[1000005];
int ile=0;
int main()
{
scanf("%d",&n);
for(int i=1;n>=i;i++)
{
scanf("%d",&t[i]);
if(t[i]==1)
ile++;
}
if(ile==0)
printf("2\n");
else if(ile==1)
printf("1\n");
else if(ile>=2)
printf("0\n");
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 | #include <bits/stdc++.h> using namespace std; int n; int t[1000005]; int ile=0; int main() { scanf("%d",&n); for(int i=1;n>=i;i++) { scanf("%d",&t[i]); if(t[i]==1) ile++; } if(ile==0) printf("2\n"); else if(ile==1) printf("1\n"); else if(ile>=2) printf("0\n"); printf("2\n"); printf("1 2\n"); return 0; } |
English