#include <cstdio> #include <algorithm> using namespace std; #define INF 2000000005 int main(){ int n; scanf("%d",&n); int sum=0; int minOdd=INF; for(int a=0;a<n;++a){ int q; scanf("%d",&q); if(q&1)minOdd=min(minOdd,q); sum+=q; } if(!(sum&1))printf("%d",sum); else if(minOdd==INF || sum==minOdd)printf("NIESTETY"); else printf("%d",sum-minOdd); return 0; }
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 <algorithm> using namespace std; #define INF 2000000005 int main(){ int n; scanf("%d",&n); int sum=0; int minOdd=INF; for(int a=0;a<n;++a){ int q; scanf("%d",&q); if(q&1)minOdd=min(minOdd,q); sum+=q; } if(!(sum&1))printf("%d",sum); else if(minOdd==INF || sum==minOdd)printf("NIESTETY"); else printf("%d",sum-minOdd); return 0; } |