#include<stdio.h>
#include<stdlib.h>
int main(){
int n=0;
int a;
int suma=0,i;
int oddcount=0,lowestodd=0;
scanf("%i",&n);
for(i=0;i<n;i++){
scanf("%i",&a);
suma=suma+a;
if ( a %2==1 ){
oddcount++;
if(oddcount==1) lowestodd=a;
if(a<lowestodd) lowestodd=a;
}
}
if(oddcount%2==1) suma=suma-lowestodd;
if (n<1){
printf("NIESTETY");
return 0;
}
if ((n==1)&&( a%2==1 )){
printf("NIESTETY");
return 0;
}
printf("%i",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 25 26 27 28 29 30 31 32 33 | #include<stdio.h> #include<stdlib.h> int main(){ int n=0; int a; int suma=0,i; int oddcount=0,lowestodd=0; scanf("%i",&n); for(i=0;i<n;i++){ scanf("%i",&a); suma=suma+a; if ( a %2==1 ){ oddcount++; if(oddcount==1) lowestodd=a; if(a<lowestodd) lowestodd=a; } } if(oddcount%2==1) suma=suma-lowestodd; if (n<1){ printf("NIESTETY"); return 0; } if ((n==1)&&( a%2==1 )){ printf("NIESTETY"); return 0; } printf("%i",suma); return 0; } |
English