#include <iostream> #include <cmath> #define int long long using namespace std; int n; int s = 0; int minO = 10000; int tmp; main (){ ios_base::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; ++i) { cin >> tmp; s += tmp; if(tmp % 2 != 0 && tmp < minO)minO = tmp; } if(s % 2 != 0)s -= minO; if(s == 0)cout << "NIESTETY" << endl; else cout << s << 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 | #include <iostream> #include <cmath> #define int long long using namespace std; int n; int s = 0; int minO = 10000; int tmp; main (){ ios_base::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; ++i) { cin >> tmp; s += tmp; if(tmp % 2 != 0 && tmp < minO)minO = tmp; } if(s % 2 != 0)s -= minO; if(s == 0)cout << "NIESTETY" << endl; else cout << s << endl; return 0; } |