当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5502:Candy Game

题目描述
Flora has many candies, which attract Preston. Flora told Preston "Let's play a game, after the game maybe you can get some candies."

Before the game starts, there is a piece of candy on the table.

Flora prepared a bag, there is $p$ balls in the bag, $q$ balls of them are sky-blue $(q < p)$, and the others are white.

The game will have $n$ rounds. The rule of each round is as follows:

Preston take out a ball from the bag, and write down its color, **then put it back into the bag.**

We assume that **the possibility of taking out every ball is equal.**

If the ball is blue, Flora will add a piece of candy on the table.

Otherwise, Flora will put all candies on the table into **a new box**, then put a new piece of candy on the table.

After n rounds, Flora put all candies on the table into **a new box**.

Flora told Preston , "you can choose a box,and eat all candies in it".

Of course, Preston will choose the box which has the most candies in it.

Now Preston wants to know the expectation of the number of candies he could eat.
输入解释
The input consists of multiple testcases.

There is an positive integer $T$ in the first line standing for the number of the testcases.

Next $T$ lines, each line contains $3$ integers $n,p,q$.

$1 \leq T \leq 10$

$1 \leq n \leq 1500$

$1 \leq q < p \leq 10^5$
输出解释
For each testcase, output one line, the expectation of the number of candies he could eat.

The output number should be rounded to $3$ decimal places.
输入样例
2
1 2 1
2 2 1
输出样例
1.500
2.000
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5502

最后修改于 2020-10-25T23:23:13+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/131072K(Java/Others)