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 <bits/stdc++.h>

using namespace std;

int vec[1001];

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int x;
		cin >> x;
		vec[x]++;
	}
	int res = 0;
	for (int i = 2; i <= 1000; i += 2)
	{
		res += vec[i] * i;
	}
	int rem = 0;
	for (int i = 999; i >= 1; i -= 2)
	{
		if (vec[i] % 2 == 0)
		{
			res += vec[i] * i;
		}
		else
		{
			rem += i;
			res += (vec[i] - 1) * i;
			if (rem % 2 == 0)
			{
				res += rem;
				rem = 0;
			}
		}
	}
	if (res != 0)cout << res << endl;
	else cout << "NIESTETY" << endl;
	return 0;
}