Legends of the Three Kingdoms

TimeLimit:4000MS  MemoryLimit:262144KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
In the game of Three Kingdoms’ Legends, there are 4 players called the Monarch, the Minister, the Rebel and theTraitor. They have $h_1, h_2, h_3, and h_4$ health points at the beginning. The players with positive health points aresurviving; the players with zero health points are dead.
The players take turns to move in each round of the game: the Monarch moves first, then the Rebel, the Minister,and finally the Traitor. In a player’s turn, if he/she is surviving, he/she must attack a player and the health points of that player will decrease by 1. Note that the dead players cannot attack the other players, and self attacking isnot allowed.
When one of the following events happens, the game ends immediately.
$\bullet$ Both of the Rebel and the Traitor are dead: The Monarch and the Minister win the game, no matter theminister is surviving or not.
$\bullet$ The Monarch is dead: If the Traitor is surviving and all the other players are dead, the Traitor wins; otherwisethe Rebel wins, no matter he/she is surviving or not.
The players have the following common knowledge on their strategies.
$\bullet$ The Monarch and the Minister never attack with each other.
$\bullet$ After attacking the chosen player, the probability of winning the game is maximized.
$\bullet$ If there are multiple players to choose, such that the winning probability is the same and maximized, all theseplayers will be chosen by equal chance.
Your task is to calculate the winning probability of each player.
Input
The first line is the number of test cases up to 10000. For each test case, there is a line containing 4 integers $h_1, h_2, h_3 and h_4$ (0 < $h_1$ < 40, 0 ≤ $h_2$ < 40, 0 ≤ $h_3$ < 40, 0 ≤ $h_4$ < 40).
Output
For each test case, output a line of 3 winning probabilities with the precision of 6 digits, in which the first one is the Monarch and the Minister’s winning probability, the second one is the Rebel’s and the last one is the Traitor’s.
SampleInput
4
1 1 1 1
1 0 1 1
1 1 1 2
2 1 2 6
SampleOutput
1.000000 0.000000 0.000000
0.000000 0.500000 0.500000
0.500000 0.500000 0.000000
0.250000 0.500000 0.250000
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签
出处

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: