// PA 2015, miodziu@poczta.fm
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <cmath>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef unsigned long long ULL;
#define mp make_pair
int read() { int n; scanf("%d", &n); return n; }
char readc() { char c; scanf("%c", &c); return c; }
LL readl() { LL n; scanf("%lld", &n); return n; }
#define REP(i,n) for (int i=0,_=(n); i<_; ++i)
#define FOR(i,a,b) for (int i=(a),_=(b); i<=_; ++i)
#define FORD(i,a,b) for (int i=(a),_=(b); i>=_; --i)
#define st first
#define nd second
int main() {
int n = read();
if (n == 1) {
int res = read();
if (res % 2 == 1)
printf("NIESTETY\n");
else
printf("%d\n", res);
return 0;
}
int res = 0;
int m = 9999;
REP(i, n) {
int x = read();
res += x;
if (x % 2 == 1)
m = std::min(m, x);
}
if (res % 2 == 1)
res -= m;
printf("%d\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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | // PA 2015, miodziu@poczta.fm #include <cstdio> #include <cstdlib> #include <vector> #include <string> #include <algorithm> #include <queue> #include <set> #include <map> #include <ctime> #include <cmath> using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef pair<int,int> PII; typedef long long LL; typedef vector<LL> VLL; typedef unsigned long long ULL; #define mp make_pair int read() { int n; scanf("%d", &n); return n; } char readc() { char c; scanf("%c", &c); return c; } LL readl() { LL n; scanf("%lld", &n); return n; } #define REP(i,n) for (int i=0,_=(n); i<_; ++i) #define FOR(i,a,b) for (int i=(a),_=(b); i<=_; ++i) #define FORD(i,a,b) for (int i=(a),_=(b); i>=_; --i) #define st first #define nd second int main() { int n = read(); if (n == 1) { int res = read(); if (res % 2 == 1) printf("NIESTETY\n"); else printf("%d\n", res); return 0; } int res = 0; int m = 9999; REP(i, n) { int x = read(); res += x; if (x % 2 == 1) m = std::min(m, x); } if (res % 2 == 1) res -= m; printf("%d\n", res); return 0; } |
English