// // Created by Kamil Borzym on 28/09/15. // Copyright © 2015 kam800. All rights reserved. // #include "stdio.h" // (1 ≤ n ≤ 1 000 000) // (1 ≤ ai ≤ 1000) int main() { long n; scanf("%ld\n", &n); long sum = 0; long minimalOdd = 0; while (n>0) { long nextBill; scanf("%ld", &nextBill); if ((nextBill & 0x01) > 0) { if (nextBill < minimalOdd || minimalOdd == 0) { minimalOdd = nextBill; } } sum += nextBill; --n; } if ((sum & 0x01) > 0) { sum -= minimalOdd; } if (sum == 0) { printf("NIESTETY\n"); } else { printf("%ld\n", sum); } 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 38 39 40 | // // Created by Kamil Borzym on 28/09/15. // Copyright © 2015 kam800. All rights reserved. // #include "stdio.h" // (1 ≤ n ≤ 1 000 000) // (1 ≤ ai ≤ 1000) int main() { long n; scanf("%ld\n", &n); long sum = 0; long minimalOdd = 0; while (n>0) { long nextBill; scanf("%ld", &nextBill); if ((nextBill & 0x01) > 0) { if (nextBill < minimalOdd || minimalOdd == 0) { minimalOdd = nextBill; } } sum += nextBill; --n; } if ((sum & 0x01) > 0) { sum -= minimalOdd; } if (sum == 0) { printf("NIESTETY\n"); } else { printf("%ld\n", sum); } return 0; } |