#include<cstdio> long long n, s=0, nn=10000000000, tmp; int main() { scanf("%lld",&n); for(int i=0; i<n; i++) { scanf("%lld",&tmp); s+=tmp; if(tmp%2==1&&tmp<nn) nn=tmp; } if(s%2==0)printf("%lld\n", s); else if(s>nn)printf("%lld\n",s-nn); else printf("NIESTETY\n"); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include<cstdio> long long n, s=0, nn=10000000000, tmp; int main() { scanf("%lld",&n); for(int i=0; i<n; i++) { scanf("%lld",&tmp); s+=tmp; if(tmp%2==1&&tmp<nn) nn=tmp; } if(s%2==0)printf("%lld\n", s); else if(s>nn)printf("%lld\n",s-nn); else printf("NIESTETY\n"); } |