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

建议使用的浏览器:

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

6418:Rikka with Stone-Paper-Scissors

题目描述
Did you watch the movie "Animal World"? There is an interesting game in this movie.

The rule is like traditional Stone-Paper-Scissors. At the beginning of the game, each of the two players receives several cards, and there are three types of cards: scissors, stone, paper. And then in each round, two players need to play out a card simultaneously. The chosen cards will be discarded and can not be used in the remaining part of the game.

The result of each round follows the basic rule: Scissors beat Paper, Paper beats Stone, Stone beats Scissors. And the winner will get $1$ point, the loser will lose $1$ point, and the points will not change in the case of a draw.

Now, Rikka is playing this game with Yuta. At first, Yuta gets $a$ Scissors cards, $b$ Stone cards and $c$ Paper cards; Rikka gets $a'$ Scissors cards, $b'$ Stone cards, $c'$ Paper cards. The parameters satisfy $a+b+c=a'+b'+c'$. And then they will play the game exactly $a+b+c$ rounds (i.e., they will play out all the cards).

Yuta's strategy is "random". Each round, he will choose a card among all remaining cards with equal probability and play it out.

Now Rikka has got the composition of Yuta's cards (i.e., she has got the parameters $a,b,c$) and Yuta's strategy (random). She wants to calculate the maximum expected final points she can get, i.e., the expected final points she can get if she plays optimally.

Hint: Rikka can make decisions using the results of previous rounds and the types of cards Yuta has played.
输入解释
The first line contains a single number $t(1\leq t \leq 10^4)$.

For each testcase, the first line contains three numbers $a,b,c$ and the second line contains three numbers $a',b',c'(0 \leq a,b,c,a',b',c' \leq 10^9, a+b+c =a' + b' + c'> 0)$.
输出解释
For each testcase, if the result is an integer, print it in a line directly.

Otherwise, if the result equals to $\frac{a}{b}(|\gcd(a,b)| = 1, b > 0,$ $a$ and $b$ are integers$)$, output "$a$/$b$" (without the quote) in a single line.
输入样例
4
2 0 0
0 2 0
1 1 1
1 1 1
1 0 0
0 0 1
123 456 789
100 200 1068
输出样例
2
0
-1
3552/19
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6418

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

共提交 0

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