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
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>

int main()
{
    using std::cin;
    using std::cout;

    long long n;
    cin >> n;

    long long b[1000];

    long long ile = 0;
    long long niep = 0;

    for (long long i = 0; i < 1000; i++)
    {
        b[i] = 0;
    }

    for (long long i = 0; i < n; i++)
    {
        long long tmp;
        cin >> tmp;
        b[tmp-1]++;
        if (tmp%2 != 0) niep++;
        else ile += tmp;
    }

    for (long long i = 0; i < 1000; i++)
    {
        if (b[i] > 0 && (i+1)%2 != 0)
        {
            if (niep%2 == 0) ile += b[i]*(i+1);
            else if (b[i]%2 == 0) ile += b[i]*(i+1);
            else ile += (b[i]-1)*(i+1);
        }
    }

    if (ile == 0) cout << "NIESTETY";
    else cout << ile;

    return 0;
}