#include <iostream>
#include <algorithm>
#define MAXN 1000006
#define INFIN 2147
#define ull unsigned long long int
using namespace std;
int N;
int tab[MAXN];
int minOdd = INFIN;
ull sum = 0;
int main(){
int t;
cin>>N;
for(int i=0;i<N;i++)
{
cin>>t;
tab[i]=t;
if(t%2!=0)minOdd=min(minOdd,t);
sum+=t;
}
if(N==1 && tab[0]%2!=0)cout<<"NIESTETY"<<endl; else
if(sum%2!=0)cout<<sum-minOdd<<endl; else
cout<<sum<<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 | #include <iostream> #include <algorithm> #define MAXN 1000006 #define INFIN 2147 #define ull unsigned long long int using namespace std; int N; int tab[MAXN]; int minOdd = INFIN; ull sum = 0; int main(){ int t; cin>>N; for(int i=0;i<N;i++) { cin>>t; tab[i]=t; if(t%2!=0)minOdd=min(minOdd,t); sum+=t; } if(N==1 && tab[0]%2!=0)cout<<"NIESTETY"<<endl; else if(sum%2!=0)cout<<sum-minOdd<<endl; else cout<<sum<<endl; return 0; } |
English