#include <cstdio> int m = 1001, n, s, A[1000000]; int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%d", A + i); if ((A[i] & 1) && A[i] < m) { m = A[i]; } s += A[i]; } if (s % 2 == 0) { printf("%d\n", s); return 0; } if (n == 1) { puts("NIESTETY"); return 0; } printf("%d\n", s - m); 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 m = 1001, n, s, A[1000000]; int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%d", A + i); if ((A[i] & 1) && A[i] < m) { m = A[i]; } s += A[i]; } if (s % 2 == 0) { printf("%d\n", s); return 0; } if (n == 1) { puts("NIESTETY"); return 0; } printf("%d\n", s - m); return 0; } |