#include <cstring> #include <cstdio> #include <cctype> using namespace std; char ch; inline void read(int &x) { while(!isdigit(ch = getchar_unlocked())); x = ch-'0'; while( isdigit(ch = getchar_unlocked())) x *= 10, x += ch-'0'; } int main() { int n, x, s = 0, min_odd = 1001, num_odd = 0; read(n); for(int i = 0; i < n; ++i) { read(x); s += x; if(x&1) { if(x < min_odd) min_odd = x; num_odd ^= 1; } } if(n > 1 || !num_odd) printf("%d\n", s - num_odd * min_odd); 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 27 28 | #include <cstring> #include <cstdio> #include <cctype> using namespace std; char ch; inline void read(int &x) { while(!isdigit(ch = getchar_unlocked())); x = ch-'0'; while( isdigit(ch = getchar_unlocked())) x *= 10, x += ch-'0'; } int main() { int n, x, s = 0, min_odd = 1001, num_odd = 0; read(n); for(int i = 0; i < n; ++i) { read(x); s += x; if(x&1) { if(x < min_odd) min_odd = x; num_odd ^= 1; } } if(n > 1 || !num_odd) printf("%d\n", s - num_odd * min_odd); else printf("NIESTETY\n"); return 0; } |