#include <stdio.h> #include <stdlib.h> int n; int l=0; long long sum=0L,a; long long minniep=10000L; main() { scanf("%d",&n); while(n--) { scanf("%Ld",&a); sum+=a; if(a%2L==1L){ l++; if(a<minniep) { minniep=a; } } } if(l%2==1) { sum-=minniep; } if(sum>0L) { printf("%Ld\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 23 24 25 26 27 28 29 30 | #include <stdio.h> #include <stdlib.h> int n; int l=0; long long sum=0L,a; long long minniep=10000L; main() { scanf("%d",&n); while(n--) { scanf("%Ld",&a); sum+=a; if(a%2L==1L){ l++; if(a<minniep) { minniep=a; } } } if(l%2==1) { sum-=minniep; } if(sum>0L) { printf("%Ld\n",sum); } else { printf("NIESTETY\n"); } return 0; } |