問題一覧 > 通常問題

No.1408 Nice Dice Game

レベル : / AI推定難易度 : 2300 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-6}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 39
作問者 : PCTprobability / テスター : akakimidori yuto1115
お気に入りにしたユーザー ProblemId : 5591 / 自分の提出
問題文最終更新日: 2021-02-26 22:01:27
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 284 (順位表) の他の問題:

Problem Statement

You are given a positive integer $N$. A and B play the following game.

For positive integers $a,b$, A has $N+1$ dice that each show a number from $1$ to $a$, and B has $N$ dice that each show a number from $1$ to $b$. All faces of these dice appear with equal probability, and the outcomes of the dice are independent. (Added at 22:01) A's dice are numbered from $1$ to $N+1$, and B's dice are numbered from $1$ to $N$. All of these dice are rolled at once. Let $X_i$ be the value shown by A's die $i$, and let $Y_i$ be the value shown by B's die $i$. Only when all of the following $2$ conditions are satisfied, the $2$ players earn exactly $\frac{1}{b(b-a)}$ points.

  • For every pair of distinct positive integers $i,j$ with $1 \le i,j \le N+1$, $i-j \equiv X_i-X_j$ $(\bmod a)$.
  • Among the positive integers $i$ satisfying $1 \le i \le N$, at least $1$ of them satisfies $Y_i > a$.

For all pairs of positive integers $a,b$ satisfying $a \neq b$, find the expected value of the points that the $2$ players can obtain from the above game, and output the value to which their sum converges. If the answer diverges, output INF.

Input

$N$

  • All inputs are integers.
  • $1 \le N \le 10^5$

Output

Output the sum, over pairs of positive integers $a,b$ satisfying $a \neq b$, of the expected value of the points B can obtain in the game. If the answer diverges, output INF. Your answer is considered correct if the smaller of the absolute error and the relative error is at most $10^{-6}$.

Sample

Sample 1
Input
3
Output
1.036927755

For example, in the case $a=3,b=5$, when A's dice show ${1,2,3,1}$ and B's dice show ${4,5,4}$, both condition $1$ and condition $2$ are satisfied, so the $2$ players earn $\frac{1}{5(5-3)}$$=$$\frac{1}{10}$ points.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。