#include <cstdio> int main(){ int z,a,min,sum; sum = 0; min = 1001; scanf("%d",&z); while(z--){ scanf("%d",&a); if((a%2) && (min>a))min=a; sum+=a; } if(sum%2){ sum -=min; } if(sum)printf("%d\n",sum); else printf("NIESTETY\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 | #include <cstdio> int main(){ int z,a,min,sum; sum = 0; min = 1001; scanf("%d",&z); while(z--){ scanf("%d",&a); if((a%2) && (min>a))min=a; sum+=a; } if(sum%2){ sum -=min; } if(sum)printf("%d\n",sum); else printf("NIESTETY\n"); return 0; } |