#include <cstdio> int main() { int n, a, min = 1024, suma = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &a); suma += a; if ((a & 1) == 1 && a < min) { min = a; } } if (min < 1024 && suma == min) printf("NIESTETY"); else if ((suma & 1) == 0) printf("%d", suma); else printf("%d", suma - min); 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 <cstdio> int main() { int n, a, min = 1024, suma = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &a); suma += a; if ((a & 1) == 1 && a < min) { min = a; } } if (min < 1024 && suma == min) printf("NIESTETY"); else if ((suma & 1) == 0) printf("%d", suma); else printf("%d", suma - min); return 0; } |