#include<cstdio> int main() { int mi=1000000009; int n; scanf("%d", &n); int sum=0; for(int i=1; i<=n; i++) { int x; scanf("%d", &x); sum+=x; if(x%2==1 && x<mi) mi=x; } if(sum%2==1) sum-=mi; if(sum<=0) printf("NIESTETY\n"); else printf("%d\n", sum); }
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 mi=1000000009; int n; scanf("%d", &n); int sum=0; for(int i=1; i<=n; i++) { int x; scanf("%d", &x); sum+=x; if(x%2==1 && x<mi) mi=x; } if(sum%2==1) sum-=mi; if(sum<=0) printf("NIESTETY\n"); else printf("%d\n", sum); } |