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
45
46
47
48
49
50
51
52
53
54
55
56
#include <stdio.h>


int n;
int oddsCount;
int odds[1000001];
int evensCount;
int evens[1000001];

int result;


int main() {
    int i;
    int tmp;

    scanf("%d", &n);
    oddsCount = 0;
    evensCount = 0;
    result = 0;
    for (i = 0; i < n; ++i) {
        scanf("%d", &tmp);
        if (tmp & 1) {
            odds[oddsCount] = tmp;
            oddsCount += 1;
        } else {
            evens[evensCount] = tmp;
            evensCount += 1;
        }
    }
    if (n <= 1) {
        if (n == 1 && oddsCount == 1) {
            printf("NIESTETY\n");
        }
        if (n < 1) {
            printf("NIESTETY\n");
        }
        return 0;
    }
    for (i = 0; i < evensCount; ++i) {
        result += evens[i];
    }
    tmp = 1001;
    for (i = 0; i < oddsCount; ++i) {
        result += odds[i];
        if (tmp > odds[i]) {
            tmp = odds[i];
        }
    }
    if (oddsCount & 1) {
        result -= tmp;
    }
    printf("%d\n", result);

    return 0;
}