#include <cstdio> int main() { unsigned n; scanf("%u", &n); unsigned value, valueMin = 999, total = 0; while (n--) { scanf("%u", &value); if (value & 1 && valueMin > value) valueMin = value; total += value; } if (total & 1) total -= valueMin; if (total) printf("%u\n", total); else printf("NIESTETY\n"); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <cstdio> int main() { unsigned n; scanf("%u", &n); unsigned value, valueMin = 999, total = 0; while (n--) { scanf("%u", &value); if (value & 1 && valueMin > value) valueMin = value; total += value; } if (total & 1) total -= valueMin; if (total) printf("%u\n", total); else printf("NIESTETY\n"); return 0; } |