No.212 Prime Dice and Composite Dice (2)
タグ : / 解いたユーザー数 326
作問者 :
LayCurse
Problem Statement
A prime die is a die whose faces have the integers \(2,3,5,7,11,13\) written on them.
A composite die is a die whose faces have the integers \(4,6,8,9,10,12\) written on them.
Write a program that finds the expected value of the product of the numbers rolled when $P$ prime dice and $C$ composite dice, for a total of $P+C$ dice, are rolled at the same time.
Each face comes up with probability $1/6$, and the faces rolled on the dice are independent of each other.
Input
$P$ $C$
$0 \leq P \leq 5$
$0 \leq C \leq 5$
$P+C \geq 1$
Output
Output the answer.
A relative error of up to $10^{-9}$ is allowed.
Sample
Sample 1
Input
1 0
Output
6.83333333333333333
The expected value of the number rolled on a prime die is $(2+3+5+7+11+13)/6$.
Sample 2
Input
3 4
Output
1419309.59119584458
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。