#include <cstdio>
int main(){
int dupa=0;
scanf("%d",&dupa);
int onecntr=0;
while(dupa--){
int tmp;
scanf("%d",&tmp);
if(tmp==1){
onecntr++;
if(onecntr>=2)
break;
}
}
int modifications;
if(onecntr>=2)
modifications=0;
else if(onecntr==1)
modifications=1;
else //no ones
modifications=2;
printf("%d\n2\n1 2\n",modifications);
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 | #include <cstdio> int main(){ int dupa=0; scanf("%d",&dupa); int onecntr=0; while(dupa--){ int tmp; scanf("%d",&tmp); if(tmp==1){ onecntr++; if(onecntr>=2) break; } } int modifications; if(onecntr>=2) modifications=0; else if(onecntr==1) modifications=1; else //no ones modifications=2; printf("%d\n2\n1 2\n",modifications); return 0; } |
English