#include<cstdio> #include<algorithm> using namespace std; typedef long long ll; int main () { ll n; ll maly = 1003, kochamtomka = 0, a; scanf ("%lld", &n); for (int i = 0; i < n; i++) { scanf ("%lld", &a); if (a%2 == 1) maly = min(maly, a); kochamtomka += a; } if (kochamtomka%2 == 1) kochamtomka -= maly; if (kochamtomka) printf("%lld\n", kochamtomka); 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 21 | #include<cstdio> #include<algorithm> using namespace std; typedef long long ll; int main () { ll n; ll maly = 1003, kochamtomka = 0, a; scanf ("%lld", &n); for (int i = 0; i < n; i++) { scanf ("%lld", &a); if (a%2 == 1) maly = min(maly, a); kochamtomka += a; } if (kochamtomka%2 == 1) kochamtomka -= maly; if (kochamtomka) printf("%lld\n", kochamtomka); else printf("NIESTETY\n"); return 0; } |