101843: [AtCoder]ABC184 D - increment of coins

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $400$ points

Problem Statement

We have a bag containing $A$ gold coins, $B$ silver coins, and $C$ bronze coins.

Until the bag contains $100$ coins of the same color, we will repeat the following operation:

Operation: Randomly take out one coin from the bag. (Every coin has an equal probability of being chosen.) Then, put back into the bag two coins of the same kind as the removed coin.

Find the expected value of the number of times the operation is done.

Constraints

  • $0 \leq A,B,C \leq 99$
  • $A+B+C \geq 1$

Input

Input is given from Standard Input in the following format:

$A$ $B$ $C$

Output

Print the expected value of the number of times the operation is done. Your output will be accepted if its absolute or relative error from the correct value is at most $10^{-6}$.


Sample Input 1

99 99 99

Sample Output 1

1.000000000

No matter what coin we take out in the first operation, the bag will contain $100$ coins of that kind.


Sample Input 2

98 99 99

Sample Output 2

1.331081081

We will do the second operation only if we take out a gold coin in the first operation. Thus, the expected number of operations is $2\times \frac{98}{98+99+99}+1\times \frac{99}{98+99+99}+1\times \frac{99}{98+99+99}=1.331081081\ldots$


Sample Input 3

0 0 1

Sample Output 3

99.000000000

Each operation adds a bronze coin.


Sample Input 4

31 41 59

Sample Output 4

91.835008202

Input

题意翻译

## 题目描述 袋子里原本有金币 $ A $ 枚、银币 $ B $ 枚、铜币 $ C $ 枚。 直到袋子中有一种硬币达到 $100$ 枚之前,都会进行以下操作。 操作:每秒钟都有 $1$ 枚硬币被等概率地取出,然后向袋子中放入两枚相同的硬币。 求出操作次数的数学期望。 ## 输入格式 输入为一行三个整数 > $ A $ $ B $ $ C $ ## 输出格式 一行一个浮点数,为操作次数的数学期望。若与标准答案的误差不超过 $ 10^{-6} $,则视为正确答案 ## 说明/提示 ### 【数据范围】 - $ 0\ \leq\ A,B,C\ \leq\ 99 $ - $ A+B+C\ \geq\ 1 $ ### 【样例解释1】 不论第一次操作取出哪种硬币,袋中都会出现 $ 100 $ 枚该种硬币。 ### 【样例解释2】 我们只会在第一次取出金币的情况下进行第二次操作,操作次数的数学期望为 $ 2\times\ \frac{98}{98+99+99}+1\times\ \frac{99}{98+99+99}+1\times\ \frac{99}{98+99+99}=1.331081081\ldots $。 ### 【样例解释3】 每次操作只会取出铜币

加入题单

算法标签: