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