// 01_kie.cpp : Defines the entry point for the console application. // #include <stdio.h> int main() { int n; int sum = 0; int min_odd = 1000; scanf("%d", &n); for (int i = 0; i < n; i++) { int a; scanf("%d", &a); sum += a; if (a < min_odd && (a & 1) == 1) { min_odd = a; } } int res = sum; if ((res & 1) == 1) { res -= min_odd; } if (res > 0) { printf("%d\n", res); } else { printf("NIESTETY\n"); } return 0; }
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 | // 01_kie.cpp : Defines the entry point for the console application. // #include <stdio.h> int main() { int n; int sum = 0; int min_odd = 1000; scanf("%d", &n); for (int i = 0; i < n; i++) { int a; scanf("%d", &a); sum += a; if (a < min_odd && (a & 1) == 1) { min_odd = a; } } int res = sum; if ((res & 1) == 1) { res -= min_odd; } if (res > 0) { printf("%d\n", res); } else { printf("NIESTETY\n"); } return 0; } |