#include <iostream> #include <cstdio> using namespace std; int main() { int n, a, minNP = 1010; long long int answ = 0; scanf("%d", &n); while(n--) { scanf("%d", &a); if(a%2 && minNP > a) minNP = a; answ += a; } if(answ % 2) { answ -= minNP; } if(answ == 0) printf("NIESTETY\n"); else printf("%lld\n", answ); 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 | #include <iostream> #include <cstdio> using namespace std; int main() { int n, a, minNP = 1010; long long int answ = 0; scanf("%d", &n); while(n--) { scanf("%d", &a); if(a%2 && minNP > a) minNP = a; answ += a; } if(answ % 2) { answ -= minNP; } if(answ == 0) printf("NIESTETY\n"); else printf("%lld\n", answ); return 0; } |