P17212 [ICPC 2017 Nanning R] Attacker-Defender Game
Description
In the game of Attacker-Defender, the defender has $h$ health points and $d$ energy points at the beginning, and the attacker has $a$ 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 $x$ (resp. $y$) points of his energy. If $x > y$, then the defender’s health points decreases by $1$ and the attacker’s energy points decreases by $x$; if $x < y$, then the defender’s health points increases by $1$ and his energy points decreases by $y$; if $x = y$, then both players’ energy points decrease by $x$ or $y$.
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.
Input Format
The first line is the number of test cases which is less than $1200$. For each test case, there is a line containing three integers $h$, $d$ and $a$, which are all positive and less than $50$.
Output Format
For each test case, output the attacker’s winning probability with the precision of $6$ digits.