#include <bits/stdc++.h> using namespace std; #define fru(j,n) for(int j=0; j<(n); ++j) #define tr(it,v) for(typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it) #define x first #define y second #define pb push_back #define ALL(G) (G).begin(),(G).end() #define DEBUG #ifdef DEBUG #define DEB printf #else #define DEB(...) #endif typedef long long ll; typedef double D; typedef pair<int,int> pii; typedef vector<int> vi; const int inft = 1000000009; const int MAXN = 1000006;//10^6 int main(){ int n,s=0,t,niep=1001; scanf("%d",&n); fru(i,n){ scanf("%d",&t); s+=t; if(t%2) niep=min(niep,t); } if(s%2){ if(n==1) printf("NIESTETY\n"); else printf("%d\n",s-niep); } 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #include <bits/stdc++.h> using namespace std; #define fru(j,n) for(int j=0; j<(n); ++j) #define tr(it,v) for(typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it) #define x first #define y second #define pb push_back #define ALL(G) (G).begin(),(G).end() #define DEBUG #ifdef DEBUG #define DEB printf #else #define DEB(...) #endif typedef long long ll; typedef double D; typedef pair<int,int> pii; typedef vector<int> vi; const int inft = 1000000009; const int MAXN = 1000006;//10^6 int main(){ int n,s=0,t,niep=1001; scanf("%d",&n); fru(i,n){ scanf("%d",&t); s+=t; if(t%2) niep=min(niep,t); } if(s%2){ if(n==1) printf("NIESTETY\n"); else printf("%d\n",s-niep); } else printf("%d\n",s); return 0; } |