問題一覧 > 通常問題

No.211 Prime Dice and Composite Dice (1)

レベル : / AI推定難易度 : 130 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 64 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-12}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 646
作問者 : LayCurse
お気に入りにしたユーザー ProblemId : 441 / 自分の提出
問題文最終更新日: 2026-06-25 02:13:28
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 105 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。