問題一覧 > 通常問題

No.212 Prime Dice and Composite Dice (2)

レベル : / AI推定難易度 : 183 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-9}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 326
作問者 : LayCurse
お気に入りにしたユーザー ProblemId : 442 / 自分の提出
問題文最終更新日: 2026-06-25 01:56:10
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 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もしくは右上の雲マークをクリックしてアカウントを作成してください。