#include <cstdio> int main() { int n, a, sum=0, leastodd=9999; scanf("%d", &n); while (n--) { scanf("%d", &a); sum += a; if (a%2 && a<leastodd) leastodd = a; } if (sum == leastodd) printf("NIESTETY\n"); else printf("%d\n", sum%2 ? sum-leastodd : sum); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 | #include <cstdio> int main() { int n, a, sum=0, leastodd=9999; scanf("%d", &n); while (n--) { scanf("%d", &a); sum += a; if (a%2 && a<leastodd) leastodd = a; } if (sum == leastodd) printf("NIESTETY\n"); else printf("%d\n", sum%2 ? sum-leastodd : sum); return 0; } |