#include<iostream>
#include<math.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
int a,b,n,sum,wyn;
cin>>n;
b=2000;
wyn=0;
sum=0;
for(int kek=0; kek<n; kek++){
cin>>a;
if(a%2==0){
wyn=wyn+a;
}
else{
b=min(a,b);
sum=sum+a;
}
}
if(sum%2==0){wyn=wyn+sum;}
else{wyn=wyn+sum-b;}
if(wyn>0){cout<<wyn;}
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 | #include<iostream> #include<math.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); int a,b,n,sum,wyn; cin>>n; b=2000; wyn=0; sum=0; for(int kek=0; kek<n; kek++){ cin>>a; if(a%2==0){ wyn=wyn+a; } else{ b=min(a,b); sum=sum+a; } } if(sum%2==0){wyn=wyn+sum;} else{wyn=wyn+sum-b;} if(wyn>0){cout<<wyn;} else{cout<<"NIESTETY";} return 0; } |
English