#include <cstdio> int min_np, n, sm , x , p[2]; int main() { scanf("%d",&n); while(n--) { scanf("%d", &x); p[x & 1]++; sm += x; min_np = (x & 1) && (!min_np || x < min_np) ? x : min_np ; } if (p[1] & 1) sm -= min_np; if (sm) printf("%d\n",sm); else puts("NIESTETY"); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <cstdio> int min_np, n, sm , x , p[2]; int main() { scanf("%d",&n); while(n--) { scanf("%d", &x); p[x & 1]++; sm += x; min_np = (x & 1) && (!min_np || x < min_np) ? x : min_np ; } if (p[1] & 1) sm -= min_np; if (sm) printf("%d\n",sm); else puts("NIESTETY"); } |