|
|||
Poker End GamesAlice and Bob love playing poker with their friends. Unfortunately, they play poker way better than their friends. Thus, almost always they are the last two players to play. The two of them can play for a long time, and it bores their friends. So they changed the rule a little bit and decided that both of them will go all in every round. Now, Alice is wondering what is the expected length of the game and what is the probability that she will win the game. Let's say, at the beginning of round i, Alice has ai Taka (currency of Bangladesh) and Bob has bi Taka, and ci is the minimum of ai and bi. Alice and Bob are equally likely to win the round. If Alice wins, she gets ci Taka from Bob, otherwise Bob gets ci Taka from her. The game ends when one of them has 0 (zero) Taka, and obviously, the person with 0 taka loses. Given that the initial amount Alice has is a0, and the initial amount that Bob has is b0, you have to find the probability that Alice is going to win and the expected number of rounds the game will be played. Input SpecificationThe input starts with a number T (0 < T ≤ 100). T test cases follow. The input for each test case is contained in a single line, and it consists of the two integers a and b (0 < a, b ≤ 150). Output SpecificationFor each test case, print the case number as shown in the sample output, followed by the expected number of rounds and the probability that Alice will win. Print both results rounded to 6 digits after the decimal point. For both values, errors less than 10-5 will be ignored. Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |