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

建议使用的浏览器:

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

3993:Horse Racing

题目描述
Tian Ji likes horse racing. Once, he and QI Wei Wang agreement, to carry out a game they discuss the good, to their horses into the upper, middle and lower third-class.

Due to individual differences, each horse's speed is unique. They started this game, the upper to the upper, middle to middle, lower to lower. Qi Wei Wang’s horses are better than Tian Ji's horses. So Tian Ji always lost. Sun Bing Tian Ji's friends gave him an idea. He let lower to upper, upper to middle, middle to lower, as you know. Then Tian Ji won.
Now Tian Ji and Qi Wei Wang host the game again, they all have n horse. As Qi Wei Wang is rich he will give some money to Tian Ji. When Qi Wei Wang lost he give 3 RMB to Tian Ji, when it is tie Qi Wei Wang gives Tian Ji 1 RMB, Of course if Tian Ji loses he would not get any money from Qi Wei Wang.
Every round Tian Ji chooses a horse first, and then Qi Wei Wang chooses a horse haven’t been chosen by random. Tian Ji want you to tell him the Expectation of money he can get. Because Tian Ji has a friend named Sun Bing so he will use the best way to choose horses.
输入解释
The first line is an integer t (<=10) indicating the case number. For each case there are three lines, the first line is an integer n (<12) indicating the number of the horses. The next two lines each have n numbers, the first line is the speed of the Qi Wei Wang’s horses, and the second is Tian Ji’s
输出解释
For each case output a line. Only a number of expectation. 6 decimal places reserved
输入样例
2
2
1 2
3 4
2
1 4
2 3
输出样例
6.000000
3.000000
来自杭电HDUOJ的附加信息
Recommend lcy

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

源链接: HDU-3993

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

共提交 0

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