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

建议使用的浏览器:

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

4136:Wimbledon

题目描述
I’m flying back to Cairo tomorrow, and do you know what is sad about that? Well, in addition to leaving beautiful Lebanon? Yep, I’m going to miss the 2011 Wimbledon final match which is going to happen while I’m 20,000 feet above sea level!
But hey, wait! I may have a shot here! At Wimbledon, matches are played only at day light, so maybe if players were not ready to give up easily on each point, then the match will extend until sunset, and the match would be suspended and resumed on Monday just for my convenience! So what I need to know is how long on average a game between two players will last, and to help me feel better you should write a computer program to determine that!
The result of a tennis match is determined by the number of “sets” each player wins, the first player to win three sets wins the match. Accordingly, all possible match results are 3-0, 3-1 and 3-2. The result of each set is determined by the number of “games” in the set each player wins, the first player to win six or more games with two or more game difference from the opponent wins the set, however if the result of a set (including the last set) leveled at 6-6 then a tie-break game is played to determine the set winner, Accordingly all possible set results are 6-0, 6-1, 6-2, 6-3, 6-4, 7-5 and 7-6 using a tie breaker game!
During each game (including tie-break), one player has the serve, this means that this player must start the play for all points of the game by hitting the ball, serving the ball is considered a big advantage. Assume that the serve starts at the first player and then alternates after each game till the end.
Given the probability of winning a game on serve for each player against his opponent, and assuming that each game lasts for five minutes, calculate the expected duration of the match.
输入解释
The first line of input contains an integer T, the number of test cases.
The first line of each test case contains the first and last names of the first player, followed by an integer (0 <= A <= 100) where A/100 is the probability that the first player wins a game on his serve against the second player. The second line contains the first and last names of the second player, followed by an integer (0 <= B <= 100) where B/100 is the probability that the second player wins a game on his serve against the first player.
输出解释
For each test case, print the case number followed by the expected duration of the match in minutes rounded to six decimal digits.
输入样例
2
Rafael Nadal 50
Roger Federer 50
Pete Sampras 100
Hamza Darwish 0
输出样例
Case #1: 199.281006
Case #2: 90.000000
提示
In the second test case, I don’t stand a chance against Pete! He always wins all games on his serve
(probability 100/100) and he also always wins all games on my serve (as I win with probability 0/100),
so he always wins the match with three straight sets (6-0, 6-0, 6-0), a total of 18 games played,
each lasting five minutes for a total of 90 minutes match.
来自杭电HDUOJ的附加信息
Recommend lcy

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

源链接: HDU-4136

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

共提交 0

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