#include <iostream>
using namespace std;
int n, s;
short int temp, best = 1001;
int main()
{
ios_base::sync_with_stdio(0);
cin >> n;
if (n == 1)
{
cin >> temp;
if (temp % 2 == 1) cout << "NIESTETY" << endl;
else cout << temp << endl;
return 0;
}
for (int i = 0; i < n; ++i)
{
cin >> temp;
if (temp < best && temp % 2 == 1) best = temp;
s += temp;
}
if (s % 2 == 0) cout << s << endl;
else cout << s - best << 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 | #include <iostream> using namespace std; int n, s; short int temp, best = 1001; int main() { ios_base::sync_with_stdio(0); cin >> n; if (n == 1) { cin >> temp; if (temp % 2 == 1) cout << "NIESTETY" << endl; else cout << temp << endl; return 0; } for (int i = 0; i < n; ++i) { cin >> temp; if (temp < best && temp % 2 == 1) best = temp; s += temp; } if (s % 2 == 0) cout << s << endl; else cout << s - best << endl; return 0; } |
English