#include <cstdio> static const int MAX_BANKNOTE = 1e6; int main() { int n; int sum = 0; int minOdd = MAX_BANKNOTE; scanf("%d", &n); while (n--) { int banknote; scanf("%d", &banknote); if ((banknote & 1) && (minOdd > banknote)) minOdd = banknote; sum += banknote; } if (sum & 1) sum -= minOdd; if (sum == 0) puts("NIESTETY"); else printf("%d\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 29 30 31 32 33 | #include <cstdio> static const int MAX_BANKNOTE = 1e6; int main() { int n; int sum = 0; int minOdd = MAX_BANKNOTE; scanf("%d", &n); while (n--) { int banknote; scanf("%d", &banknote); if ((banknote & 1) && (minOdd > banknote)) minOdd = banknote; sum += banknote; } if (sum & 1) sum -= minOdd; if (sum == 0) puts("NIESTETY"); else printf("%d\n", sum); return 0; } |