Problem E
Fleecing the Raffle
Naturally, it is against the raffle rules to put your name in the box more than once. However, it is only cheating if you are actually caught, and since not even the raffle organizers want to spend time checking all the names in the box, the only way you can get caught is if your name ends up being drawn for more than one of the prizes. This means that cheating and placing your name more than once can sometimes increase your chances of winning a prize.
You know the number of names in the raffle box placed by other people, and the number of prizes that will be given out. By carefully choosing how many times to add your own name to the box, how large can you make your chances of winning a prize (i.e., the probability that your name is drawn exactly once)?
Input
The input consists of a single line containing two integers $n$ and $p$ ($2 \le p \le n \le 10^6$), where $n$ is the number of names in the raffle box excluding yours, and $p$ is the number of prizes that will be given away.
Output
Output a single line containing the maximum possible probability of winning a prize, accurate up to an absolute error of $10^{-6}$.
Sample Input 1 | Sample Output 1 |
---|---|
3 2 |
0.6 |
Sample Input 2 | Sample Output 2 |
---|---|
23 5 |
0.45049857550 |