Juan have N red marbles, M blue marbles, and K bottles. He will put a certain number of marbles on each of the K bottles such that no bottle remains empty and every marble is inside a bottle.
Andres is a Santa Fe fan, so he will pick one bottle at random with an uniform distribution, then he will pick a marble inside of it at random with an uniform distribution, with the hope is a red marble. As Juan is a Millonarios fan, he wants to distribute the marbles in the bottles such that the probability of Andres picking a blue marble is maximized. Juan has a busy life, therefore he needs your help to determine the best arrangement for the marbles and the probability of Andres getting a blue marble.
Input
The input consist of three integers separated by spaces, N M and K (1 ≤ N, M, K ≤ 109) - the number of red marbles, blue marbles and bottles respectively.
Output
Print the probability of Bob getting a blue marble such that the marble arrangement is optimal. Your answer will be considered correct, if its absolute or relative error does not exceed 10 - 6.
Example
Input
50 50 2
Output
0.747474747
题意如下
你有50个红色大理石,50个蓝色大理石和2个罐子。
你的朋友会随机从其中一个罐子里拿出一块大理石。你必须将所有100个大理石放在两个罐子中,但你必须使用所有100个大理石和两个罐子。你怎么能最大化你的朋友画红色大理石的机会?
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
int main()
{
int a,b,c;
cin >> a >> b >> c;
if(b<=c-1){
printf("%.9lf",(b)*1.000000000/c*1.000000000);
}
else{
double sum=((c-1)*1.00000000/c*1.00000000)+((b-c+1)*1.000000000/(b-c+1+a)*1.000000000/(c)*1.000000000);
printf("%.9lf",sum);
}
return 0;
}