#include <cstdio> using namespace std; int main() { int n; scanf("%d", &n); int w = 0; int mn = 1000000000; for(int i = 0; i < n; i++) { int c; scanf("%d", &c); w += c; if(c & 1 && c < mn) mn = c; } if(w & 1) w -= mn; if(w == 0) printf("NIESTETY"); else printf("%d", w); 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 | #include <cstdio> using namespace std; int main() { int n; scanf("%d", &n); int w = 0; int mn = 1000000000; for(int i = 0; i < n; i++) { int c; scanf("%d", &c); w += c; if(c & 1 && c < mn) mn = c; } if(w & 1) w -= mn; if(w == 0) printf("NIESTETY"); else printf("%d", w); return 0; } |