#include<iostream> using namespace std; int main(){ long long b,n,suma=0,a=100000000000000000; cin>>n; for(int x=0;x<n;x++){ cin>>b; suma+=b; if(b<a&&b%2==1)a=b; } if(suma%2==1)suma=suma-a; if(suma==0)cout<<"NIESTETY"; else cout<<suma; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include<iostream> using namespace std; int main(){ long long b,n,suma=0,a=100000000000000000; cin>>n; for(int x=0;x<n;x++){ cin>>b; suma+=b; if(b<a&&b%2==1)a=b; } if(suma%2==1)suma=suma-a; if(suma==0)cout<<"NIESTETY"; else cout<<suma; return 0; } |