codeforces 680A A. Bear and Five Cards(水题)

时间:2021-12-11 22:21:11

题目链接:

A. Bear and Five Cards

//#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <queue>
#include <cmath>
#include <map>
#include <cstring>
#include <algorithm>
#include <cstdio> using namespace std;
#define Riep(n) for(int i=1;i<=n;i++)
#define Riop(n) for(int i=0;i<n;i++)
#define Rjep(n) for(int j=1;j<=n;j++)
#define Rjop(n) for(int j=0;j<n;j++)
#define mst(ss,b) memset(ss,b,sizeof(ss));
typedef long long LL;
template<class T> void read(T&num) {
char CH; bool F=false;
for(CH=getchar();CH<''||CH>'';F= CH=='-',CH=getchar());
for(num=;CH>=''&&CH<='';num=num*+CH-'',CH=getchar());
F && (num=-num);
}
int stk[], tp;
template<class T> inline void print(T p) {
if(!p) { puts(""); return; }
while(p) stk[++ tp] = p%, p/=;
while(tp) putchar(stk[tp--] + '');
putchar('\n');
} const LL mod=1e9+;
const double PI=acos(-1.0);
const LL inf=1e14;
const int N=1e5+; int a[],flag[];
int main()
{
int sum=;
for(int i=;i<=;i++)read(a[i]),sum+=a[i],flag[a[i]]++;
int ans=sum;
for(int i=;i<=;i++)
{
if(flag[a[i]]>&&flag[a[i]]<)
ans=min(ans,sum-flag[a[i]]*a[i]);
else if(flag[a[i]]>)
{
ans=min(ans,sum-*a[i]);
}
}
cout<<ans<<"\n"; return ;
}