/*
* main.cpp
*
* Created on: Sep 29, 2015
* Author: jakub
*/
#include <iostream>
#include <cstdlib>
#include <climits>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
int n;
uint c = 0, s = 0, m = UINT32_MAX, x;
cin >> n;
while(n--) {
cin >> x;
s += x;
c ^= x;
if(x % 2 == 1)
m = min(m, x);
}
if(c % 2 == 1)
s -= m;
if(s == 0)
cout << "NIESTETY" << endl;
else
cout << s << endl;
return EXIT_SUCCESS;
}
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 | /* * main.cpp * * Created on: Sep 29, 2015 * Author: jakub */ #include <iostream> #include <cstdlib> #include <climits> using namespace std; int main() { ios_base::sync_with_stdio(false); int n; uint c = 0, s = 0, m = UINT32_MAX, x; cin >> n; while(n--) { cin >> x; s += x; c ^= x; if(x % 2 == 1) m = min(m, x); } if(c % 2 == 1) s -= m; if(s == 0) cout << "NIESTETY" << endl; else cout << s << endl; return EXIT_SUCCESS; } |
English