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

建议使用的浏览器:

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

6224:Legends of the Three Kingdoms

题目描述
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.
输入解释
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).
输出解释
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.
输入样例
4
1 1 1 1
1 0 1 1
1 1 1 2
2 1 2 6
输出样例
1.000000 0.000000 0.000000
0.000000 0.500000 0.500000
0.500000 0.500000 0.000000
0.250000 0.500000 0.250000
来自杭电HDUOJ的附加信息
Recommend jiangzijing2015

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

源链接: HDU-6224

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

共提交 0

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