No.1230 Hall_and_me
タグ : / 解いたユーザー数 285
作問者 :
theory_and_me
/ テスター :
IKyopro
Problem Statement
There are $3$ treasure chests (called chest $1$, chest $2$, and chest $3$, respectively) and $1$ diamond. The diamond can be placed inside a chest, and when a chest is closed, its contents cannot be seen from the outside.
You play a game with the game master, Hall. In this game, Hall hides the diamond in one of the $3$ chests, and you try to obtain the diamond by opening $1$ chest.
The game proceeds as follows.
- While you are not looking, Hall puts the diamond into some $1$ of the $3$ chests and closes all the chests. Here, the chest to hold the diamond is chosen at random: chest $1$ with probability $\frac{P}{P+Q+R}$, chest $2$ with probability $\frac{Q}{P+Q+R}$, and chest $3$ with probability $\frac{R}{P+Q+R}$. Here, $P, Q, R$ are non-negative integers, and at least $1$ of them is positive. At this point you do not know which chest the diamond is hidden in, but you do know the values of $P, Q, R$.
- You put a mark on some $1$ chest (you do not open it at this point). Then, you choose which of the $2$ strategies, "STAY" or "CHANGE", to apply in step 4 (the details of each strategy are explained in step 4).
- Of the $2$ chests other than the one you marked, Hall opens the one that does not contain the diamond. However, if neither of those chests contains the diamond, Hall opens $1$ of the $2$ chests with equal probability.
- At this point, the unopened chests are the $2$ chests consisting of the marked one and the unmarked one, and one of them contains the diamond. If you chose "STAY" in step 2, you open the "marked chest". If you chose "CHANGE", you open the "chest that is unmarked and not yet opened".
- If the chest you opened contains the diamond, you obtain it.
Now, in step 2 you can decide "which chest to mark" and "which of the strategies "STAY" and "CHANGE" to adopt". With appropriate decisions, what is the maximum probability that you obtain the diamond?
Input
$P\ Q\ R$
$0 \leq P, Q, R \leq 100$
$P, Q, R$ are all integers, and at least $1$ of them is positive.
Output
Output the answer on $1$ line.
Print a newline at the end.
Your answer is considered correct if the absolute or relative error is at most $10^{-8}$.
Sample
Sample 1
Input
100 0 0
Output
1.000000000000
For example, the above value can be achieved by "marking chest $1$" and "adopting the strategy "STAY"".
Sample 2
Input
1 1 1
Output
0.666666666667
For example, the above value can be achieved by "marking chest $1$" and "adopting the strategy "CHANGE"". (21:36 Fixed because there was an extra space at the end of the sample.)
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。