#include <iostream> using namespace std; int main() { int suma = 0, suma_np = 0, n, k, min = 1000; cin >> n; while (n--) { cin >> k; suma += k; if (k%2 && k < min) min = k; } if (suma%2) suma -= min; if (suma != 0) cout<<suma; else cout<<"NIESTETY"; 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 main() { int suma = 0, suma_np = 0, n, k, min = 1000; cin >> n; while (n--) { cin >> k; suma += k; if (k%2 && k < min) min = k; } if (suma%2) suma -= min; if (suma != 0) cout<<suma; else cout<<"NIESTETY"; return 0; } |