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

建议使用的浏览器:

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

3273:Lottery

Special Judge 特殊评判
题目描述
Your living city is holding a big lottery game now! There are M people in this city who want to play this lottery. Everyone of them must pay C dollars to get a lottery ticket. Taking this ticket, he can get a chance to win a prize by randomly selecting one from N indistinguishable boxes and getting the prize if there is a ball in the selected box. The ball in the selected box is also taken by this winner, so if a box with a ball happens to be selected by a player, it will never contain balls from then on, but it will be closed and can be selected by the future players. Every box contains exactly one ball at the beginning, and two or more players cannot select the boxes and the same time.

Of course, the latter you join this game, the less the chance you win a prize will be. So the lottery holder make such a rule: If you are the n-th player who wins a prize, you will get A*(n-1)+B dollars. That is to say, the first winner will get B dollars, the second winner will get A+B dollars, the income of the third winner is 2*A+B, and so on.

Being curious about the expected profit, the lottery holder is too lazy to calculate it himself. So he finds you and give you a lot of money to do this work. If you can solve it quickly, you will be a millionaire!
输入解释
The first line of input is a integer T, the number of test cases. Each case contains exactly 5 integers M, N, C, A, B in this order, where 1 <= M, N <= 10^6 and 0 <= C, A, B <= 100.
输出解释
For each test case, print a line contains a single real number which is the expected profit got. You can output the result with any precision you like, but the relative error should less than or equal to 1e-5.
输入样例
3
1 2 10 5 7
2 2 10 5 7
7 5 0 0 1
输出样例
3
7
-3.95142
来自杭电HDUOJ的附加信息
Author wywcgs
Recommend chenheng

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

源链接: HDU-3273

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

共提交 0

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