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