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
#include <stdio.h>
#include <limits>

bool isOdd(int note) {
    return note % 2 != 0;
}

int main() {
    int n;
    scanf("%d", &n);

    int sumNotes = 0;
    int minOddNote = std::numeric_limits<int>::max();

    for(int i = 0 ; i < n ; ++i) {
        int note;
        scanf("%d", &note);

        if(isOdd(note) && note < minOddNote) {
            minOddNote = note;
        }

        sumNotes += note;
    }

    //there had to be at least one odd note, so i don't have to check it
    if(isOdd(sumNotes)) {
        sumNotes = sumNotes - minOddNote;
    }

    if(sumNotes > 0 ){
        printf("%d\n", sumNotes);
    } else {
        printf("NIESTETY\n");
    }

    return 0;
}