#include <cstdio> int main() { int n; long long sum = 0; long long min = 1001; int odd_count = 0; scanf("%d", &n); for (int i = 0; i < n; ++i) { long long v; scanf("%lld", &v); sum += v; if (v & 0x1) { ++odd_count; if (v < min) min = v; } } if (odd_count & 0x1) { sum -= min; } if (sum == 0) printf("NIESTETY\n"); else printf("%lld\n", 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 | #include <cstdio> int main() { int n; long long sum = 0; long long min = 1001; int odd_count = 0; scanf("%d", &n); for (int i = 0; i < n; ++i) { long long v; scanf("%lld", &v); sum += v; if (v & 0x1) { ++odd_count; if (v < min) min = v; } } if (odd_count & 0x1) { sum -= min; } if (sum == 0) printf("NIESTETY\n"); else printf("%lld\n", sum); return 0; } |