#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <cstdio>
#include <vector>
#include <utility>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define ST first
#define ND second
#define MP make_pair
#define PB push_back
#define QI queue <int>
#define VI vector <int>
#define PII pair <int,int>
#define SZ(x) (int)(x).size()
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define SYNC ios_base::sync_with_stdio(0)
#define MAX(a,b) ((a) > (b)) ? a : b
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
const int INF = 1e9 + 7;
const int BASE = 1 << 20;
int a, b, c, d, e, f, n, m, q, suma, ile, mn = INF;
int main()
{
scanf("%d", &n);
for(int i = 1; i <= n; i++)
{
scanf("%d", &a);
if(a & 1 == 1)
{
ile++;
mn = min(mn, a);
}
suma += a;
}
if(ile & 1 == 1)
{
suma -= mn;
}
if(suma == 0)
{
puts("NIESTETY");
}
else
{
printf("%d\n", suma);
}
}
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 60 61 62 63 64 | #include <set> #include <map> #include <cmath> #include <queue> #include <stack> #include <string> #include <cstdio> #include <vector> #include <utility> #include <cstdlib> #include <iostream> #include <algorithm> #define ST first #define ND second #define MP make_pair #define PB push_back #define QI queue <int> #define VI vector <int> #define PII pair <int,int> #define SZ(x) (int)(x).size() #define ALL(x) x.begin(),x.end() #define RALL(x) x.rbegin(),x.rend() #define SYNC ios_base::sync_with_stdio(0) #define MAX(a,b) ((a) > (b)) ? a : b using namespace std; typedef long long LL; typedef long double LD; typedef unsigned int UI; typedef unsigned long long ULL; const int INF = 1e9 + 7; const int BASE = 1 << 20; int a, b, c, d, e, f, n, m, q, suma, ile, mn = INF; int main() { scanf("%d", &n); for(int i = 1; i <= n; i++) { scanf("%d", &a); if(a & 1 == 1) { ile++; mn = min(mn, a); } suma += a; } if(ile & 1 == 1) { suma -= mn; } if(suma == 0) { puts("NIESTETY"); } else { printf("%d\n", suma); } } |
English