#include <cstdio> #include <cstdint> #include <climits> const static uint32_t MAX_A = 1001; using namespace std; int main() { uint32_t n, a, minOdd, sum; sum = 0; minOdd = MAX_A; scanf("%lu", &n); for (uint32_t i = 0; i < n; ++i) { scanf("%lu", &a); sum += a; if (a & 1 && a < minOdd) minOdd = a; } if (sum & 1) sum -= minOdd; if (sum) printf("%lu", sum); else printf("NIESTETY"); 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 | #include <cstdio> #include <cstdint> #include <climits> const static uint32_t MAX_A = 1001; using namespace std; int main() { uint32_t n, a, minOdd, sum; sum = 0; minOdd = MAX_A; scanf("%lu", &n); for (uint32_t i = 0; i < n; ++i) { scanf("%lu", &a); sum += a; if (a & 1 && a < minOdd) minOdd = a; } if (sum & 1) sum -= minOdd; if (sum) printf("%lu", sum); else printf("NIESTETY"); return 0; } |