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

建议使用的浏览器:

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

2947:Bicycle Puzzle

题目描述
Per and Gunnar has found a wonderful online bicycle picture puzzle fiash solitaire game, and since they are very competitive, they want to find out who is best.

The purpose of the game is to descramble a picture of a bicycle. At the start of each game, the picture of the bicycle is cut into W times H equally sized rectangles and scrambled randomly.


Then the player repeatedly chooses two arbitrary rectangles and swaps them. He continues to swap rectangles until the picture is complete again. The game keeps track of the number of swaps, which is the score for that particular playthrough.


After Gunnar has played a game, he sends his score (along with W and H) to Per, and challenges Per to beat this score. Per soon realizes that if he is unlucky with the scrambling, it is impossible to beat Gunnar's score.


Per quickly writes a program to find out the probability that he can beat Gunnar's score (assuming that all scrambled pictures are equally probable) if he plays optimally.


But he is not sure whether his program is correct and wants to verify its correctness by challenging you to write the same program.
输入解释
The first line of the input consists of a single number T, the number of scenarios. Each scenario is given by a line with three integers W, H and S, where S is Gunnar's last score.
输出解释
For each scenario, output a line with the probability that Per beats Gunnar's score. Format the probability as an irreducible fraction where the numerator and the denominator are separated by /. Output only the numerator if the answer is an integer.


Notes and Constraints
0 < T <= 150
0 < W <= 5
0 < H <= 4
0 <= S <= W * H
When comparing two scores, the lowest one is best.
输入样例
3
1 1 1
1 2 1
3 1 2
输出样例
1
1/2
2/3
来自杭电HDUOJ的附加信息
Recommend gaojie

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

题目来源 IDI Open 2009

源链接: HDU-2947

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

共提交 0

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