#include <stdio.h> int main (void){ int n,nominal,min=1000,suma=0; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&nominal); if((n==1)&&(nominal%2!=0)) suma=0; else{ if((nominal%2!=0)&&(nominal<min))min=nominal; suma+=nominal; } } if(suma==0){printf("NIESTETY\n"); return 0; } if(suma%2!=0) suma-=min; 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 | #include <stdio.h> int main (void){ int n,nominal,min=1000,suma=0; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&nominal); if((n==1)&&(nominal%2!=0)) suma=0; else{ if((nominal%2!=0)&&(nominal<min))min=nominal; suma+=nominal; } } if(suma==0){printf("NIESTETY\n"); return 0; } if(suma%2!=0) suma-=min; printf("%d\n",suma); return 0; } |