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