No.574 Regular Polyhedron Dice
Problem Statement
Here is a die in the shape of a regular $F$-hedron with $F$ faces. Each face has an integer from $1$ to $F$ written on it, and the integers written on any 2 different faces are different. Each face comes up with the same probability $1/F$. When this die is thrown $N$ times, what is the expected value of the $K$-th largest of the values rolled?
Input
$F$ $N$ $K$
$F=4,6,8,12,20$
$1 \le N \le 100$
$1 \le K \le N$
$N,K$ are integers.
Output
Output the expected value. Answers with a relative error of at most $10^{-6}$ are accepted. Print a newline at the end.
Sample
Sample 1
Input
4 2 1
Output
3.125
A regular tetrahedral die is thrown 2 times. There are 16 possible outcomes, $(1,1), \ldots, (4,4)$. Among them, the maximum is 4 in 7 cases, 3 in 5 cases, 2 in 3 cases, and 1 in 1 case, so the expected value is $(7 \times 4 + 5 \times 3 + 3 \times 2 + 1 \times 1) / 16 = 25/8 = 3.125$.
Sample 2
Input
6 1 1
Output
3.5
This is the expected value of a roll of an ordinary 6-sided die, so the answer is $(1+2+3+4+5+6)/6=3.5$.
Sample 3
Input
20 100 49
Output
10.797029702971770
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
はむこ