No.3483 A Forbidden Fruit
タグ : / 解いたユーザー数 49
作問者 : 👑
hamamu
Problem Statement
Here there are $N$ kinds of fruit, with $M$ fruits of each kind. Fruits of different kinds can be distinguished from each other, but fruits of the same kind cannot.
Alice wants to eat these fruits.
However, among these fruits, $1$ is a forbidden fruit. If she eats it, Alice will collapse.
Also, fruits of the same kind as the forbidden fruit have the characteristic of "having a peculiar sweetness", and when Alice eats a fruit, she can determine whether it has the peculiar sweetness.
If the fruit she ate had the peculiar sweetness, she learns that the forbidden fruit is among the fruits of the same kind as that fruit; if the fruit she ate did not have the peculiar sweetness, she learns that the forbidden fruit is not among the fruits of the same kind as that fruit.
Alice wants to repeatedly choose and eat a fruit, one at a time, from the $NM$ fruits, eating a total of $K$ fruits. That is, she repeats choosing $1$ fruit and eating it.
Find the probability when Alice acts so as to maximize "the probability that she can choose and eat $K$ fruits without collapsing".
$T$ test cases are given; solve each of them.
Constraints
- All inputs are integers
- $1 \leq T \leq 10^5$
- $2 \leq N \leq 10^5$
- $1 \leq M \leq 10^5$
- $1 \leq K \leq NM - 1$
Input
The input is given from standard input in the following format, where $\mathrm{case}_i$ denotes the $i$-th test case.
$T$
$\mathrm{case}_1$
$\mathrm{case}_2$
$\vdots$
$\mathrm{case}_T$
Each case is given in the following format.
$N$ $M$ $K$
Output
Output the probability that Alice can eat $K$ fruits without collapsing. There is data created so that its absolute or relative error from the true value of the required probability is at most $10^{-14}$; against that data, your program's output is judged correct if its absolute or relative error is at most $10^{-9}$.
Sample
Sample 1
Input
3 3 1 1 3 1 2 4 9 5
Output
0.66666666667 0.33333333333 0.97222222222
For the $1, 2$-th test cases, with $3$ kinds of fruit and $1$ fruit of each kind, $1$ of the optimal strategies is "repeatedly choose $1$ fruit at random from the remaining fruits and eat it".
The probability that Alice can eat $1$ fruit without collapsing is $\dfrac{2}{3}$, and the probability that she can eat $2$ fruits is $\dfrac{1}{3}$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。