#include <cstdio> int main() { long long sum=0; int lowest =0; int temp; int n; scanf("%d", &n); while(n--) { scanf("%d", &temp); sum=sum+temp; if(temp%2==1&&(lowest==0||temp<lowest)) {lowest=temp;} } if(sum%2==1) sum-=lowest; if(sum==0) printf("NIESTETY"); else printf("%lld", sum); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <cstdio> int main() { long long sum=0; int lowest =0; int temp; int n; scanf("%d", &n); while(n--) { scanf("%d", &temp); sum=sum+temp; if(temp%2==1&&(lowest==0||temp<lowest)) {lowest=temp;} } if(sum%2==1) sum-=lowest; if(sum==0) printf("NIESTETY"); else printf("%lld", sum); return 0; } |