Jrahc as a Jewelbreaker
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Description
Jrahc has developed a jewel-breaking game. In this game, you can process diamonds by striking them with a chosen force.
Specifically, for a diamond of size , you may choose a positive integer . According to the game's rules, the diamond will disappear, and for each divisor of , a diamond of size will be generated with probability .
In particular, diamonds of size cannot be struck.
Clearly, this game may violate the law of conservation of matter. After being criticized by Coinred, Jrahc refused to change the code and instead posed a game theory challenge to him:
Suppose there are several diamonds in the game. We take turns processing them, with me going first. On each turn, you must strike the largest diamond currently present. If all diamonds are of size 1, the player who cannot make a move loses. What is my probability of winning if we both play optimally?
Coinred must correctly answer this question to convince Jrahc to change his game, but he is not good at game theory—so he has come to you for help.
Format
Input
The first line contains one integer , the number of diamonds.
The second line contains integers , the sizes of the diamonds.
Output
One rational number, representing the probability of winning, formatted to six decimal places.
Samples
2
1 2
1.000000
2
2 2
0.000000