#include <iostream> using namespace std; int main() { int n, y=1000, z; long long x; cin>>n>>x; if((n!=1)&&(x%2==0)) { do { cin>>z; x+=z; if((z%2==0)&&(z<y)) z=y; n--; } while(n>1); if(x%2!=0) cout<<x-z; else cout<<x; } else cout<<"NIESTETY"; return 0; }
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 | #include <iostream> using namespace std; int main() { int n, y=1000, z; long long x; cin>>n>>x; if((n!=1)&&(x%2==0)) { do { cin>>z; x+=z; if((z%2==0)&&(z<y)) z=y; n--; } while(n>1); if(x%2!=0) cout<<x-z; else cout<<x; } else cout<<"NIESTETY"; return 0; } |