#include<cstdio> #include<iostream> long long int a, sum, N, mini = 1000000009; bool b; int main() { scanf("%lld",&N); for(int i = 0; i < N; ++ i) { scanf("%lld",&a); sum += a; if(a%2==1) { mini=std::min(mini,a); } } if (sum%2==1) sum -= mini; if(sum>0) printf("%lld",sum); else printf("NIESTETY"); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include<cstdio> #include<iostream> long long int a, sum, N, mini = 1000000009; bool b; int main() { scanf("%lld",&N); for(int i = 0; i < N; ++ i) { scanf("%lld",&a); sum += a; if(a%2==1) { mini=std::min(mini,a); } } if (sum%2==1) sum -= mini; if(sum>0) printf("%lld",sum); else printf("NIESTETY"); } |