[ An Ac a Day ^_^ ] CodeForces 680A Bear and Five Cards

 这两天回家了

家里电脑太卡 调试不方便

就只能写写水题了……

 1 #include<stdio.h>
 2 #include<iostream>
 3 #include<algorithm>
 4 #include<math.h>
 5 #include<string.h>
 6 #include<string>
 7 #include<map>
 8 #include<set>
 9 #include<vector>
10 #include<queue>
11 #define M(a,b) memset(a,b,sizeof(a))
12 using namespace std;
13 typedef long long ll;
14 int cnt[105];
15 int main(){
16     int a,max_=-1,sum=0,cost=0;
17     for(int i=0;i<5;i++){
18         scanf("%d",&a);
19         sum+=a;
20         cnt[a]++;
21         if(cnt[a]==2)
22             cost=a*2;
23         else if(cnt[a]>=3)
24             cost=a*3;
25         if(cost>max_)
26             max_=cost;
27     }
28     printf("%d
",sum-max_);
29     return 0;
30 }
31 /*
32 
33 7 3 7 3 20
34 
35 7 9 3 1 8
36 
37 10 10 10 10 10
38 
39 */
原文地址:https://www.cnblogs.com/general10/p/5778328.html