#include <algorithm> #include <cstdio> int main() { int N; scanf("%d", &N); int min_odd = 1100; unsigned long long SUM = 0; for(int i = 0; i < N; ++i) { int now; scanf("%d", &now); SUM += now; if( now % 2 == 1 ) { min_odd = std::min(min_odd, now); } } bool NIESTETY = false; if( SUM % 2 == 1 ) { if( min_odd == 1100 || SUM == min_odd ) { NIESTETY = true; } SUM -= min_odd; } if( NIESTETY ) { printf("NIESTETY\n"); } else { printf("%lld\n", SUM); } }
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 | #include <algorithm> #include <cstdio> int main() { int N; scanf("%d", &N); int min_odd = 1100; unsigned long long SUM = 0; for(int i = 0; i < N; ++i) { int now; scanf("%d", &now); SUM += now; if( now % 2 == 1 ) { min_odd = std::min(min_odd, now); } } bool NIESTETY = false; if( SUM % 2 == 1 ) { if( min_odd == 1100 || SUM == min_odd ) { NIESTETY = true; } SUM -= min_odd; } if( NIESTETY ) { printf("NIESTETY\n"); } else { printf("%lld\n", SUM); } } |