#include <iostream> #include <stdio.h> using namespace std; int main() { int ile; unsigned long long suma = 0, minNieparzysta = 18446744073709551615, temp; scanf("%llu", &ile); while (ile--){ scanf("%llu", &temp); if (minNieparzysta > temp && temp%2!=0) minNieparzysta = temp; suma += temp; } if (suma % 2 != 0)suma -= minNieparzysta; if (suma % 2 != 0 || suma==0) printf("NIESTETY"); else printf("%llu",suma); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <iostream> #include <stdio.h> using namespace std; int main() { int ile; unsigned long long suma = 0, minNieparzysta = 18446744073709551615, temp; scanf("%llu", &ile); while (ile--){ scanf("%llu", &temp); if (minNieparzysta > temp && temp%2!=0) minNieparzysta = temp; suma += temp; } if (suma % 2 != 0)suma -= minNieparzysta; if (suma % 2 != 0 || suma==0) printf("NIESTETY"); else printf("%llu",suma); } |