#include <stdio.h> int main() { int n; int a; int sum = 0; int min_odd = 1000001; int result; scanf("%d", &n); for(int i=0; i<n; i++) { scanf("%d", &a); sum += a; if(a%2==1 && a<min_odd) min_odd = a; } result = (sum %2 == 0) ? sum : sum - min_odd; if(result > 0) printf("%d\n", result); else printf("NIESTETY\n"); }
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 | #include <stdio.h> int main() { int n; int a; int sum = 0; int min_odd = 1000001; int result; scanf("%d", &n); for(int i=0; i<n; i++) { scanf("%d", &a); sum += a; if(a%2==1 && a<min_odd) min_odd = a; } result = (sum %2 == 0) ? sum : sum - min_odd; if(result > 0) printf("%d\n", result); else printf("NIESTETY\n"); } |