#include <cstdio> int main() { int n; scanf("%d", &n); int min_np = 1000, tmp, suma = 0; while (n--) { scanf("%d", &tmp); if (tmp % 2 == 1) if (tmp < min_np) min_np = tmp; suma += tmp; } if (suma % 2 == 0) { printf("%d\n", suma); } else { if (suma - min_np == 0) printf("NIESTETY\n"); else printf("%d\n", suma - min_np); } 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 | #include <cstdio> int main() { int n; scanf("%d", &n); int min_np = 1000, tmp, suma = 0; while (n--) { scanf("%d", &tmp); if (tmp % 2 == 1) if (tmp < min_np) min_np = tmp; suma += tmp; } if (suma % 2 == 0) { printf("%d\n", suma); } else { if (suma - min_np == 0) printf("NIESTETY\n"); else printf("%d\n", suma - min_np); } return 0; } |