#include <cstdio> const int inf = 2015; int main() { int n, mn = inf, sum = 0; scanf("%d", &n); for(int l, i = 0; i < n; ++i) { scanf("%d", &l); sum += l; if(l & 1 && l < mn) mn = l; } if(sum & 1) { if(mn == sum) { printf("NIESTETY\n"); return 0; } sum -= mn; } 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 | #include <cstdio> const int inf = 2015; int main() { int n, mn = inf, sum = 0; scanf("%d", &n); for(int l, i = 0; i < n; ++i) { scanf("%d", &l); sum += l; if(l & 1 && l < mn) mn = l; } if(sum & 1) { if(mn == sum) { printf("NIESTETY\n"); return 0; } sum -= mn; } printf("%d\n", sum); return 0; } |