#include<cstdio> using namespace std; long long int tab[1000006]; int main() { long long int najw_np = 10000; int n; scanf("%d", &n); long long int suma = 0; for(int i = 0; i < n; i++) { long long int tmp; scanf("%lld", &tmp); suma = suma + tmp; if(tmp %2 == 1) { if(najw_np > tmp) najw_np = tmp; } } if(suma%2 == 1) { suma -= najw_np; } if(suma == 0) { printf("NIESTETY\n"); } else { printf("%lld\n", suma); } }
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<cstdio> using namespace std; long long int tab[1000006]; int main() { long long int najw_np = 10000; int n; scanf("%d", &n); long long int suma = 0; for(int i = 0; i < n; i++) { long long int tmp; scanf("%lld", &tmp); suma = suma + tmp; if(tmp %2 == 1) { if(najw_np > tmp) najw_np = tmp; } } if(suma%2 == 1) { suma -= najw_np; } if(suma == 0) { printf("NIESTETY\n"); } else { printf("%lld\n", suma); } } |