//KIE #include <cstdio> int main() { int S; int next; int npar=0; int sum; int minnpar=0; scanf("%d",&S); for(int i=0;i<S;i++) { scanf("%d",&next); sum+=next; if(next%2) { npar++; if(minnpar>next||minnpar==0) minnpar = next; } else npar+=2; } if( npar<2 ) printf("NIESTETY"); else if( npar%2 ) { printf("%d",sum-minnpar); } else { printf("%d",sum); } 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 | //KIE #include <cstdio> int main() { int S; int next; int npar=0; int sum; int minnpar=0; scanf("%d",&S); for(int i=0;i<S;i++) { scanf("%d",&next); sum+=next; if(next%2) { npar++; if(minnpar>next||minnpar==0) minnpar = next; } else npar+=2; } if( npar<2 ) printf("NIESTETY"); else if( npar%2 ) { printf("%d",sum-minnpar); } else { printf("%d",sum); } return 0; } |