// kie.cpp : Defines the entry point for the console application.
//
#include "iostream"
using namespace std;
int main()
{
int n;
cin >> n;
int sum = 0;
int odC = 0;
int smallest = 1000000000;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
sum += x;
if (x % 2 == 1) {
odC++;
if (x < smallest)smallest = x;
}
}
if (odC % 2 == 1)sum -= smallest;
if (sum == 0)
cout << "NIESTETY\n";
else
cout << sum << "\n";
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 28 29 | // kie.cpp : Defines the entry point for the console application. // #include "iostream" using namespace std; int main() { int n; cin >> n; int sum = 0; int odC = 0; int smallest = 1000000000; for (int i = 0; i < n; i++) { int x; cin >> x; sum += x; if (x % 2 == 1) { odC++; if (x < smallest)smallest = x; } } if (odC % 2 == 1)sum -= smallest; if (sum == 0) cout << "NIESTETY\n"; else cout << sum << "\n"; return 0; } |
English