No.211 Prime Dice and Composite Dice (1)
タグ : / 解いたユーザー数 646
作問者 :
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 probability that the product of the rolled values is $K$ when one prime die and one composite die are rolled, $1$ of each.
Each face appears with probability $1/6$, and the faces shown by the dice are independent.
Input
$K$
$0 \leq K \leq 200$: integer
Output
Output the answer.
An absolute error of up to $10^{-12}$ is allowed.
Sample
Sample 1
Input
7
Output
0.00000000000000000
The product can never be a prime number...
Sample 2
Input
50
Output
0.0277777777777777778
This happens only when the prime die shows $5$ and the composite die shows $10$, so the answer is $1/36$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。