#include <cstdio> #include <cstdint> int32_t main() { int32_t total_notes /* n */, total_sum = 0, minimum_odd = INT32_MAX; scanf("%d", &total_notes); // read n for (int32_t i = 0; i < total_notes; i++) { int32_t note /* a_i */; scanf("%d", ¬e); // read a_i total_sum += note; if (note % 2 == 1 && note < minimum_odd) { minimum_odd = note; } } if (total_sum % 2 == 0) { printf("%d\n", total_sum); } else if (total_sum - minimum_odd == 0) { printf("NIESTETY\n"); } else { printf("%d\n", total_sum - minimum_odd); } 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 | #include <cstdio> #include <cstdint> int32_t main() { int32_t total_notes /* n */, total_sum = 0, minimum_odd = INT32_MAX; scanf("%d", &total_notes); // read n for (int32_t i = 0; i < total_notes; i++) { int32_t note /* a_i */; scanf("%d", ¬e); // read a_i total_sum += note; if (note % 2 == 1 && note < minimum_odd) { minimum_odd = note; } } if (total_sum % 2 == 0) { printf("%d\n", total_sum); } else if (total_sum - minimum_odd == 0) { printf("NIESTETY\n"); } else { printf("%d\n", total_sum - minimum_odd); } return 0; } |