#include <stdio.h> int main() { int sum = 0, smallestOdd = 1001; int n; scanf("%i", &n); for(int i = 0; i < n; ++i) { int tmp; scanf("%i", &tmp); sum += tmp; if(tmp%2 == 1 && tmp < smallestOdd) smallestOdd = tmp; } if(sum%2 == 1) sum -= smallestOdd; if(sum == 0) printf("NIESTETY\n"); else printf("%i\n", sum); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <stdio.h> int main() { int sum = 0, smallestOdd = 1001; int n; scanf("%i", &n); for(int i = 0; i < n; ++i) { int tmp; scanf("%i", &tmp); sum += tmp; if(tmp%2 == 1 && tmp < smallestOdd) smallestOdd = tmp; } if(sum%2 == 1) sum -= smallestOdd; if(sum == 0) printf("NIESTETY\n"); else printf("%i\n", sum); return 0; } |