logo AlgoBeat OnlineJudge
登录 注册

#217311. [ICPC 2017 Nanning R] Attacker-Defender Game

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

In the game of Attacker-Defender, the defender has health points and energy points at the beginning, and the attacker has energy points.

In each round of the game, the attacker and the defender move simultaneously. In the attacker’s (resp. defender’s) move, he shows (resp. ) points of his energy. If , then the defender’s health points decreases by and the attacker’s energy points decreases by ; if , then the defender’s health points increases by and his energy points decreases by ; if , then both players’ energy points decrease by or .

When one of the following two events happens, the game ends.

  • The defender has no health points: The attacker wins.
  • The attacker’s energy points is less than the defender’s health points: The defender wins.

Both of them play with the strategies such that their winning probabilities are maximized when the opponent is playing optimally. Your task is to calculate their winning probabilities.

输入格式

The first line is the number of test cases which is less than . For each test case, there is a line containing three integers , and , which are all positive and less than .

输出格式

For each test case, output the attacker’s winning probability with the precision of digits.

样例

样例输入 1

3
1 1 1
1 2 2
1 3 3

样例输出 1

0.000000
0.500000
0.750000