// Krzysztof Baranski #include <cstdio> int main() { int n; scanf("%d", &n); bool odd = false; long long sum = 0; long long min = -1; while(n--) { int next; scanf("%d", &next); sum += next; if(next % 2) { odd = !odd; if(min == -1 || next < min) { min = next; } } } if(odd) sum -= min; if(sum != 0) { printf("%lld\n", sum); } 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 21 22 23 24 25 26 27 28 29 30 31 | // Krzysztof Baranski #include <cstdio> int main() { int n; scanf("%d", &n); bool odd = false; long long sum = 0; long long min = -1; while(n--) { int next; scanf("%d", &next); sum += next; if(next % 2) { odd = !odd; if(min == -1 || next < min) { min = next; } } } if(odd) sum -= min; if(sum != 0) { printf("%lld\n", sum); } else { printf("NIESTETY\n"); } return 0; }; |