/*
Potyczki Algorytmiczne 2015
Michal Ganczorz
*/
#include <iostream>
#include <string>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#define ll long long
using namespace std;
// ll tab[1000042];
int main()
{
cin.tie(NULL);
std::ios::sync_with_stdio(false);
ll sum = 0;
ll mn_odd = 1000042;
int n;
cin>>n;
for(int i=0; i<n; ++i)
{
ll t = 0;
cin>>t;
sum += t;
if(t%2)
mn_odd = min(t, mn_odd);
}
if(sum % 2)
{
if(mn_odd == 1000042) mn_odd = 0;
sum -= mn_odd;
if(sum)
cout<<sum<<"\n";
else
cout<<"NIESTETY\n";
}
else
cout<<sum<<"\n";
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 51 52 53 54 | /* Potyczki Algorytmiczne 2015 Michal Ganczorz */ #include <iostream> #include <string> #include <stdlib.h> #include <time.h> #include <math.h> #include <vector> #include <map> #include <queue> #include <algorithm> #define ll long long using namespace std; // ll tab[1000042]; int main() { cin.tie(NULL); std::ios::sync_with_stdio(false); ll sum = 0; ll mn_odd = 1000042; int n; cin>>n; for(int i=0; i<n; ++i) { ll t = 0; cin>>t; sum += t; if(t%2) mn_odd = min(t, mn_odd); } if(sum % 2) { if(mn_odd == 1000042) mn_odd = 0; sum -= mn_odd; if(sum) cout<<sum<<"\n"; else cout<<"NIESTETY\n"; } else cout<<sum<<"\n"; return 0; } |
English