#include <stdio.h>
#include <stdlib.h>
int main() {
long int n,m,s,t;
scanf("%ld\n", &n);
m = s = 0;
while (n--) {
scanf("%ld", &t);
if ( ((t % 2) == 1) && (m == 0 || m > t) ) {
m = t;
}
s += t;
}
if ((s % 2) == 1) {
s -= m;
}
if (s == 0) {
printf("NIESTETY\n");
} else {
printf("%ld\n", s);
}
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 | #include <stdio.h> #include <stdlib.h> int main() { long int n,m,s,t; scanf("%ld\n", &n); m = s = 0; while (n--) { scanf("%ld", &t); if ( ((t % 2) == 1) && (m == 0 || m > t) ) { m = t; } s += t; } if ((s % 2) == 1) { s -= m; } if (s == 0) { printf("NIESTETY\n"); } else { printf("%ld\n", s); } return 0; } |
English