IITKWPCN  Playing With Balls
There are W white balls and B black balls in a bag. A magician is performing tricks by drawing balls from the bag.
In each step, the magician randomly removes any two balls from the bag. If the drawn balls are of the same color, he will put one white ball in the bag, otherwise he will put a black ball in it. The two drawn balls from the bag from the ball are discarded.
He keeps on doing the above tricks until there is only one ball remaining in the bag.
Given W and B, you have to determine the probability that the color of last ball remaining in the bag is black. You should print the answer with accuracy of upto 6 decimal digits.
Input
T : no of test cases (1 <= T <= 10^4)
For every test case W and B are given (0 <= W <= 10^8 and 0 <= B <= 10^8 and W + B != 0)
Output
For each test case, output the probability as stated in the problem statement.
Example
Input: 2
1 1 1 2
Output:
1.000000
0.000000
hide comments
pankaj sharma:
20160629 22:11:00
I solved the problem using observation,but I was trying to figure out the general formula for this. Was anyone able to get a general formula of the probability? 

hash7:
20160602 20:11:00
dont think as the problem setter wants you to think.. make some sample output and analyze it... you will get a 2 line logic :) nyc question 

geoffreymace7:
20151013 08:21:15
Nice question! 

dwij28:
20150908 18:46:33
Takes a bit of a time to understand, and then just 3 lines in python. :D 

Shivam Singh:
20150820 23:34:23
The probability is always 0 or 1, it does not depend on the randomness of the system.


[Mayank Pratap]:
20150609 17:02:37
Solve HC before this ... ..... I solved HC before but had to use arrays ....this time I had no choice.....


ashish jaiswal:
20150327 06:40:05
The two drawn balls from the bag from the ball are discarded..


jobanpreet singh:
20150208 07:16:08
Easy by observation.


Petar Bosnjak:
20140929 23:53:42
so easy :D 

siddharth tiwari:
20140929 17:54:16
eurekaaaaaa..!!! 
Added by:  praveen123 
Date:  20130806 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All 
Resource:  IITK ACA CSE online judge 