//Szymon Wozniak #include <cstdio> typedef long long ll; int main() { ll n,minodd = 2001; ll a; ll res = 0; scanf("%lld", &n); for(ll i = 0; i < n; i++) { scanf("%lld", &a); res += a; if( a%2 == 1 && a < minodd) { minodd = a; } } if(minodd == 2001 || res % 2 == 0) minodd = 0; res -= minodd; if(res > 0) printf("%lld\n", res); 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 29 30 31 32 33 34 35 | //Szymon Wozniak #include <cstdio> typedef long long ll; int main() { ll n,minodd = 2001; ll a; ll res = 0; scanf("%lld", &n); for(ll i = 0; i < n; i++) { scanf("%lld", &a); res += a; if( a%2 == 1 && a < minodd) { minodd = a; } } if(minodd == 2001 || res % 2 == 0) minodd = 0; res -= minodd; if(res > 0) printf("%lld\n", res); else printf("NIESTETY\n"); return 0; } |