// Author: Kamil Nizinski
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>
#include <math.h>
#define debug(fmt,...) fprintf(stderr,fmt, ## __VA_ARGS__)
#define mp make_pair
#define ft first
#define sd second
#define psb push_back
#define ppb pop_back
using namespace std;
typedef long long int ll;
typedef long long unsigned llu;
typedef double dd;
int main()
{
int n,i,x;
scanf("%d",&n);
int minOdd=1003;
ll sum=0ll;
for(i=0;i<n;i++) {
scanf("%d",&x);
if(x%2==1 && x < minOdd) minOdd=x;
sum+=1ll*x;
}
if(sum%2ll == 1ll) sum-=1ll*minOdd; // we must have had at least one odd number
if(sum==0ll) printf("NIESTETY\n");
else printf("%lld\n",sum);
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 | // Author: Kamil Nizinski #include <cstdlib> #include <cstdio> #include <iostream> #include <vector> #include <queue> #include <algorithm> #include <cstring> #include <math.h> #define debug(fmt,...) fprintf(stderr,fmt, ## __VA_ARGS__) #define mp make_pair #define ft first #define sd second #define psb push_back #define ppb pop_back using namespace std; typedef long long int ll; typedef long long unsigned llu; typedef double dd; int main() { int n,i,x; scanf("%d",&n); int minOdd=1003; ll sum=0ll; for(i=0;i<n;i++) { scanf("%d",&x); if(x%2==1 && x < minOdd) minOdd=x; sum+=1ll*x; } if(sum%2ll == 1ll) sum-=1ll*minOdd; // we must have had at least one odd number if(sum==0ll) printf("NIESTETY\n"); else printf("%lld\n",sum); return 0; } |
English