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

int main()
{
    int totalBillsNumber = 0;
    int lowestOddValue = 1001;
    int totalOddValues = 0;
    int totalSum = 0;
    scanf("%d", &totalBillsNumber);
    for (int i=0; i<totalBillsNumber; ++i)
    {
        int value;
        scanf("%d", &value);
        if (value%2 == 1)
        {
            if (lowestOddValue > value)
                lowestOddValue = value;
            totalOddValues++;
        }
        totalSum+=value;
    }
    if (totalOddValues%2 == 1)
        totalSum-=lowestOddValue;
    if (totalOddValues == 1 && totalBillsNumber == 1)
    {
        printf("%s", "NIESTETY");
        return 0;
    }
    printf("%d", totalSum);
}