// PA2015, runda 1, Kieszonkowe // Andrzej Pezarski #include <cstdio> #include <cstdlib> #include <vector> #include <set> #include <map> #include <algorithm> #include <cassert> using namespace std; int main () { int N, S=0, M=1000000; scanf("%d", &N); for (int i=0; i<N; i++) { int x; scanf("%d", &x); S+=x; if (x&1) M=min(M, x); } if (S&1) S-=M; if (S==0) printf("NIESTETY\n"); else printf("%d\n", S); 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 | // PA2015, runda 1, Kieszonkowe // Andrzej Pezarski #include <cstdio> #include <cstdlib> #include <vector> #include <set> #include <map> #include <algorithm> #include <cassert> using namespace std; int main () { int N, S=0, M=1000000; scanf("%d", &N); for (int i=0; i<N; i++) { int x; scanf("%d", &x); S+=x; if (x&1) M=min(M, x); } if (S&1) S-=M; if (S==0) printf("NIESTETY\n"); else printf("%d\n", S); return 0; } |