#include <algorithm> #include <cstdio> using namespace std; typedef long long ll; ll total, smallest_odd; int n; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { ll ai; scanf("%lld", &ai); total += ai; if (ai % 2) smallest_odd = smallest_odd ? min(smallest_odd, ai) : ai; } ll ans = (total % 2) ? total - smallest_odd : total; if (ans) { printf("%lld\n", ans); } 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 | #include <algorithm> #include <cstdio> using namespace std; typedef long long ll; ll total, smallest_odd; int n; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { ll ai; scanf("%lld", &ai); total += ai; if (ai % 2) smallest_odd = smallest_odd ? min(smallest_odd, ai) : ai; } ll ans = (total % 2) ? total - smallest_odd : total; if (ans) { printf("%lld\n", ans); } else { printf("NIESTETY\n"); } return 0; } |