#include <bits/stdc++.h>
int main()
{
long long s;
int n, i, x, odd, min_odd;
scanf("%d", &n);
min_odd = INT_MAX;
for(s = i = odd = 0; i < n; ++i)
{
scanf("%d", &x);
if(x % 2)
min_odd = std::min(min_odd, x),
++odd;
s += x;
}
if(odd % 2 && odd > 1)
printf("%d\n", s - min_odd);
else
puts("NIESTETY");
}
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 | #include <bits/stdc++.h> int main() { long long s; int n, i, x, odd, min_odd; scanf("%d", &n); min_odd = INT_MAX; for(s = i = odd = 0; i < n; ++i) { scanf("%d", &x); if(x % 2) min_odd = std::min(min_odd, x), ++odd; s += x; } if(odd % 2 && odd > 1) printf("%d\n", s - min_odd); else puts("NIESTETY"); } |
English