No.1003 Dice Implementation (1)
タグ : / 解いたユーザー数 640
作問者 :
trineutron
/ テスター :
37zigen
Problem Statement
Dice are used in many games, but a poor implementation can produce dice that are clearly biased.
There is a random number generator that generates integers from $0$ to $N - 1$ with equal probability. The result of the die roll is the integer obtained by adding $1$ to the remainder when the generated integer is divided by $6$. For example, if $21$ is generated, the result of the roll is $4$. Determine whether this method can make the die rolls free of bias.
Input
$N$
An integer $N$ satisfying $1 \le N \le 2^{16}$ is given on 1 line.
Output
Print Yes if an unbiased die can be made by the method described in the problem statement, and No otherwise. Print a newline at the end.
Sample
Sample 1
Input
8
Output
No
The probability of rolling 1 or 2 is 2/8 each, and the probability of rolling each of 3 through 6 is 1/8.
Sample 2
Input
6
Output
Yes
The probability of rolling each of 1 through 6 is 1/6.
Sample 3
Input
65536
Output
No
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。