#include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); unsigned long long a, b, c, d; a=b=c=d=0; cin >> a; for (unsigned long long i=0; i<a; i++) { cin >> b; c+=b; if (b%2==1 && (b<d || d==0)) d=b; } if (c%2==0) cout << c << endl; else if (c-d==0) cout << "NIESTETY" << endl; else cout << c-d << endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); unsigned long long a, b, c, d; a=b=c=d=0; cin >> a; for (unsigned long long i=0; i<a; i++) { cin >> b; c+=b; if (b%2==1 && (b<d || d==0)) d=b; } if (c%2==0) cout << c << endl; else if (c-d==0) cout << "NIESTETY" << endl; else cout << c-d << endl; } |