No.1408 Nice Dice Game
タグ : / 解いたユーザー数 39
作問者 :
PCTprobability
/ テスター :
akakimidori
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もしくは右上の雲マークをクリックしてアカウントを作成してください。