#include<iostream> #include<cstdio> using namespace std; int t, suma, mini, a; int main() { scanf("%d", &t); suma=0; mini=1001; for(int p=0; p<t; p++) { scanf("%d", &a); suma+=a; if(a%2==1)mini=min(mini, a); } if(suma%2==0)printf("%d\n", suma); else { suma-=mini; if(suma==0)printf("NIESTETY\n"); else printf("%d\n", suma); } 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 | #include<iostream> #include<cstdio> using namespace std; int t, suma, mini, a; int main() { scanf("%d", &t); suma=0; mini=1001; for(int p=0; p<t; p++) { scanf("%d", &a); suma+=a; if(a%2==1)mini=min(mini, a); } if(suma%2==0)printf("%d\n", suma); else { suma-=mini; if(suma==0)printf("NIESTETY\n"); else printf("%d\n", suma); } return 0; } |