// Michal Wos, UW, PA 15, zad kieszonkowe
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
int n, a;
unsigned long long res = 0;
const int BRAK = 9999999;
int minodd = BRAK;
scanf("%d", &n);
while (n--)
{
scanf("%d", &a);
res += a;
if ( a & 1 )
{
minodd = min(minodd, a);
}
}
if ( (res & 1) && (minodd != BRAK) )
{
res -= minodd;
}
if ( (res & 1) || res == 0 )
{
printf("NIESTETY\n");
}
else
{
printf("%llu\n", res);
}
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 | // Michal Wos, UW, PA 15, zad kieszonkowe #include <cstdio> #include <algorithm> using namespace std; int main() { int n, a; unsigned long long res = 0; const int BRAK = 9999999; int minodd = BRAK; scanf("%d", &n); while (n--) { scanf("%d", &a); res += a; if ( a & 1 ) { minodd = min(minodd, a); } } if ( (res & 1) && (minodd != BRAK) ) { res -= minodd; } if ( (res & 1) || res == 0 ) { printf("NIESTETY\n"); } else { printf("%llu\n", res); } return 0; } |
English