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
30
31
32
#include <iostream>

using namespace std;

int main()
{
    int tabSize = 0;
    int minOddNumb = 1000001;
    int sumOfMoney = 0;
    int tmp = 0;

    // wczytanie pierwszej wartoœci
    cin >> tabSize;
    for (int i = 0; i<tabSize; i++) {
        cin >> tmp;
        sumOfMoney += tmp;
        if (tmp%2 == 1 && tmp < minOddNumb)
            minOddNumb = tmp;
    }

    if (tabSize > 0) {
        if (sumOfMoney%2 == 0) {
            cout << sumOfMoney;
        } else if (tabSize > 1) {
            cout << sumOfMoney - minOddNumb;
        } else {
            cout << "NIESTETY";
        }
    }

    return 0;
}