#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int n, s, w, p, c;
int main()
{
scanf("%d", &n);
p = 1001;
for (int i = 0; i < n; ++i)
{
scanf("%d", &s);
w += s;
if (s % 2 == 1)
{
c++;
p = min(p, s);
}
}
if (c % 2 == 1)
{
w = w - p;
}
if (w == 0)
{
printf("NIESTETY");
}
else
{
printf("%d", w);
}
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #include <cstdio> #include <algorithm> #include <cmath> using namespace std; int n, s, w, p, c; int main() { scanf("%d", &n); p = 1001; for (int i = 0; i < n; ++i) { scanf("%d", &s); w += s; if (s % 2 == 1) { c++; p = min(p, s); } } if (c % 2 == 1) { w = w - p; } if (w == 0) { printf("NIESTETY"); } else { printf("%d", w); } return 0; } |
English