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

建议使用的浏览器:

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

4191:Game, Set and Match

题目描述
In this problem you need to assist in computing the probability of winning at tennis. Here is a brief explanation of how the scoring system works. In a tennis match, players play a certain number of consecutive sets. Each set is in turn made up of a series of games (and may include a tie-break if needed). Finally each game is made of points.

Points. Every point is started by one of the players serving (i.e. hitting the ball into the service box in the opposite court) and the other receiving serve. The server then attempts to return the ball into the server's
court and players alternate hitting the ball across the net. When one of the players fails to make a legal return (e.g. if the ball is knocked out of the court), he or she loses the point. The speci cs of how points are won are not important to us.

Games. The scoring system within a game is peculiar to say the least. As the player wins points in a game, his score goes from the initial value of 0 (read "love") to 15, 30, or 40 (yes, just when you think you're starting to spot a pattern in this mess it breaks down). There is no a-priori limit to the length of a game (meaning the number of points played), but a player's score is always indicated by one of these numbers according to the following rules. When a player has three points (score 40) and wins the following point as well, he wins the game unless the scoreline was 40-40 (read "deuce") to start with. A player needs to win two consecutive points from deuce to win the game. Winning one gives him advantage; if followed by a second winning point the game is won by him, but if followed by a losing point the score reverts to deuce.
Example: at 40-30, if the fi rst player wins the next point he wins the game. However, if the second player wins the next three points the game is his.

Sets. A player wins a set if he wins at least four games (in the current set) and he is two games ahead of his opponent but, as you may be starting to suspect, there is yet another exception. In case the scoreline for the number of games won reaches six-all (6-6), a tie-break is played instead to decide the set.
Example: at 5-4, if the fi rst player wins the next game he takes the set 6-4. But if he loses, the set is still undecided and can eventually go to either 7-5, 5-7 or a tie-break.

Tie-break. A tie-break (and the set to which it belongs) is won when a player wins at least seven points by a margin of two points or more.

Match. The winner of a match is the rst player to win 2 sets (the wins do not need to be consecutive). Hence a match may go to 2 or 3 sets depending on how the game develops.

Rafa has been carefully studying his past performances against his next opponent and he knows he wins each point with probability precisely p, irrespective of whether he is serving or receiving and regardless of all other points played. Can you help him assess his chances of winning the match?
输入解释
Each test case is described by a single floating point number p, 0<=p<=1 in its own line. A value of -1 for p marks the end of the input.
输出解释
For each test case, print a single line with the probabilities of Rafa winning a given game, set and match,respectively. These three numbers must be separated by a space character. Your answers should be accurate to within an absolute error of 10-6.
输入样例
0.5
0.3
0.7
-1
输出样例
0.50000000000 0.50000000000 0.50000000000
0.09921103448 0.00016770463 0.00000008437
0.90078896552 0.99983229537 0.99999991563
来自杭电HDUOJ的附加信息
Recommend lcy

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

题目来源 SWERC 2011

源链接: HDU-4191

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

共提交 0

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