#include <stdio.h> using namespace std; int main(void){ int n,i,suma=0; int min_nparz=1001; scanf("%d",&n); int tmp; for(i=0;i<n;i++){ scanf("%d",&tmp); suma+=tmp; if(tmp%2==1&&tmp<min_nparz) min_nparz=tmp; } if(suma%2==0) {printf("%d",suma);return 0;} else { suma-=min_nparz; if(suma==0){printf("NIESTETY"); return 0;} else {printf("%d", suma); return 0;} } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <stdio.h> using namespace std; int main(void){ int n,i,suma=0; int min_nparz=1001; scanf("%d",&n); int tmp; for(i=0;i<n;i++){ scanf("%d",&tmp); suma+=tmp; if(tmp%2==1&&tmp<min_nparz) min_nparz=tmp; } if(suma%2==0) {printf("%d",suma);return 0;} else { suma-=min_nparz; if(suma==0){printf("NIESTETY"); return 0;} else {printf("%d", suma); return 0;} } } |