#include <stdio.h> typedef unsigned int I; typedef unsigned long long L; int main() { I n, a; scanf("%u\n", &n); I minnp = 1u<<30; L sum = 0; for (I i=0; i<n; ++i) { scanf("%u", &a); sum += a; if ((a & 1) && a < minnp) minnp = a; } if (sum & 1) { sum -= minnp; } if (sum == 0) printf("NIESTETY\n"); else printf("%llu\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 | #include <stdio.h> typedef unsigned int I; typedef unsigned long long L; int main() { I n, a; scanf("%u\n", &n); I minnp = 1u<<30; L sum = 0; for (I i=0; i<n; ++i) { scanf("%u", &a); sum += a; if ((a & 1) && a < minnp) minnp = a; } if (sum & 1) { sum -= minnp; } if (sum == 0) printf("NIESTETY\n"); else printf("%llu\n", sum); return 0; } |