#include <iomanip>
#include <iostream>
#include <utility>
#include <algorithm>
#include <cassert>
#include <string>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define ALL(x) x.begin(), x.end()
#define VAR(a,b) __typeof (b) a = b
#define REP(i,n) for (int _n=(n), i=0; i<_n; ++i)
#define FOR(i,a,b) for (int _b=(b), i=(a); i<=_b; ++i)
#define FORD(i,a,b) for (int _b=(b), i=(a); i>=_b; --i)
#define FORE(i,a) for (VAR(i,a.begin ()); i!=a.end (); ++i)
#define IN(x) int x; cin >> x
#define PB push_back
#define MP make_pair
#define ST first
#define ND second
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int> PII;
typedef double LD;
const int DBG = 0, INF = int(1e9);
int main() {
ios_base::sync_with_stdio(0);
cout.setf(ios::fixed);
IN(n);
VI v;
int res = 0;
REP(i, n) {
IN(a);
res += a;
if (1 == a % 2) v.PB(a);
}
sort(ALL(v));
if (1 == v.size() % 2) res -= v[0];
if (0 == res)
cout << "NIESTETY\n";
else
cout << res << endl;
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 | #include <iomanip> #include <iostream> #include <utility> #include <algorithm> #include <cassert> #include <string> #include <vector> #include <set> #include <map> using namespace std; #define ALL(x) x.begin(), x.end() #define VAR(a,b) __typeof (b) a = b #define REP(i,n) for (int _n=(n), i=0; i<_n; ++i) #define FOR(i,a,b) for (int _b=(b), i=(a); i<=_b; ++i) #define FORD(i,a,b) for (int _b=(b), i=(a); i>=_b; --i) #define FORE(i,a) for (VAR(i,a.begin ()); i!=a.end (); ++i) #define IN(x) int x; cin >> x #define PB push_back #define MP make_pair #define ST first #define ND second typedef vector<int> VI; typedef long long LL; typedef pair<int,int> PII; typedef double LD; const int DBG = 0, INF = int(1e9); int main() { ios_base::sync_with_stdio(0); cout.setf(ios::fixed); IN(n); VI v; int res = 0; REP(i, n) { IN(a); res += a; if (1 == a % 2) v.PB(a); } sort(ALL(v)); if (1 == v.size() % 2) res -= v[0]; if (0 == res) cout << "NIESTETY\n"; else cout << res << endl; return 0; } |
English