中文。
Promote my blog.
First, consider the greedy algorithm. Assume that the guesses are always correct, so discuss different cases.
Reduce one card from the types.
Reduce one card from the types.
Reduce one card from either the types or the types. Since they are equal, it doesn’t matter which one to reduce.
Code:
#include<bits/stdc++.h>
using namespace std;
#define int long long
int a,b,t;
signed main(){
cin>>a>>b;
while(a!=0||b!=0){
if(a<b) b--,t++;
else if(a>b) a--,t++;
else a--;
}
printf("%.8f",t*1.0);
return 0;
}