// Copyright 2015 kajko
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <limits>
using namespace std;
int main() {
int32_t minOdd = numeric_limits<int32_t>::max();
int32_t nOdd = 0;
int64_t total = 0;
int32_t n;
cin >> n;
for (int32_t i = 0; i < n; ++i) {
int32_t a;
cin >> a;
total += a;
if (a & 0x1) {
++nOdd;
minOdd = min(minOdd, a);
}
}
if (nOdd & 0x1)
total -= minOdd;
if (total > 0)
cout << total << endl;
else
cout << "NIESTETY" << endl;
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 34 35 | // Copyright 2015 kajko #include <algorithm> #include <cstdint> #include <iostream> #include <limits> using namespace std; int main() { int32_t minOdd = numeric_limits<int32_t>::max(); int32_t nOdd = 0; int64_t total = 0; int32_t n; cin >> n; for (int32_t i = 0; i < n; ++i) { int32_t a; cin >> a; total += a; if (a & 0x1) { ++nOdd; minOdd = min(minOdd, a); } } if (nOdd & 0x1) total -= minOdd; if (total > 0) cout << total << endl; else cout << "NIESTETY" << endl; return 0; } |
English