codeforce 621A Wet Shark and Odd and Even

最大偶数和

 1 #include<iostream>
 2 #include<string>
 3 #include<algorithm>
 4 #include<cstdlib>
 5 #include<cstdio>
 6 #include<set>
 7 #include<map>
 8 #include<vector>
 9 #include<cstring>
10 #include<stack>
11 #include<cmath>
12 #include<queue>
13 #include <bits/stdc++.h>
14 using namespace std;
15 #define INF 0x3f3f3f3f
16 #define ll long long
17 #define clc(a,b) memset(a,b,sizeof(a))
18 const int maxn=400010;
19 
20 int main()
21 {
22     int n;
23     scanf("%d",&n);
24     ll x;
25     ll sum=0;
26     ll y=INF;
27     for(int i=0; i<n; i++)
28     {
29         scanf("%I64d",&x);
30         sum+=x;
31         if(x%2)
32             y=min(y,x);
33     }
34 //    cout<<sum<<endl;
35     if(sum%2)
36         sum=sum-y;
37     printf("%I64d\n",sum);
38     return 0;
39 }
View Code

 

posted @ 2016-02-01 13:42  yyblues  阅读(240)  评论(0编辑  收藏  举报