/* Zadanie: KIE Kieszonkowe [B] Potyczki Algorytmiczne 2015, runda 1. */ #include<iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); unsigned const int omax=99999; unsigned int n,a,s=0,on=0,o=omax; cin >>n; while(n--) { cin >>a; s+=a; if (a&1) { o=min(o,a); on^=1; } } if (on) s-=o; if (s) cout <<s <<endl; else cout <<"NIESTETY" <<endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | /* Zadanie: KIE Kieszonkowe [B] Potyczki Algorytmiczne 2015, runda 1. */ #include<iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); unsigned const int omax=99999; unsigned int n,a,s=0,on=0,o=omax; cin >>n; while(n--) { cin >>a; s+=a; if (a&1) { o=min(o,a); on^=1; } } if (on) s-=o; if (s) cout <<s <<endl; else cout <<"NIESTETY" <<endl; } |