/* * File: main.cpp * Author: zbigniew * * Created on 28 wrzesień 2015, 19:40 */ #include <cstdlib> #include <iostream> using namespace std; /* * */ int main(int argc, char** argv) { int n,i,min=1000,kie=0; //int a[5]={3,3,4,3,3}; int a; cin >> n; for (i=0 ; i<n;i++) { cin >> a; kie=kie+a; if (a>a/2*2 && a<min) min=a; } if (kie>kie/2*2) kie=kie-min; if (kie>0) cout<<kie; else cout<<"NIESTETY"<<endl; 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 28 29 30 31 32 33 34 | /* * File: main.cpp * Author: zbigniew * * Created on 28 wrzesień 2015, 19:40 */ #include <cstdlib> #include <iostream> using namespace std; /* * */ int main(int argc, char** argv) { int n,i,min=1000,kie=0; //int a[5]={3,3,4,3,3}; int a; cin >> n; for (i=0 ; i<n;i++) { cin >> a; kie=kie+a; if (a>a/2*2 && a<min) min=a; } if (kie>kie/2*2) kie=kie-min; if (kie>0) cout<<kie; else cout<<"NIESTETY"<<endl; return 0; } |