IEEEBGAM - The Ball Game

Taru and Hanaku play a ball game. The game is played with N white balls, N black balls and N boxes. Hanaku chooses one box randomly and one ball from it randomly. Taru has to arrange the balls in such a way that the probability of Hanaku choosing a White ball is maximised. None of the boxes after the arrangement should be empty. Your task is to find that maximum probability.

Input

The first line contains the number of test cases (T) followed by T lines each an integer N.

Output

For each test case output the maximum probability of getting a white ball which is possible with an arrangement for the above configuration. Print the answer rounded to 8 decimal places.

Constraints

T <= 20
N <= 1000

Example

Sample Input:
1
1

Sample Output:
0.50000000

Added by:Saransh Bansal
Date:2012-03-21
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2013-05-04 09:38:21 nai)(
Emphasize on "MAXIMIZE" rest is esay :D
2013-02-04 21:04:49 raunakrocks
esy1....:)
2013-01-22 03:46:26 Kevin Sebastian
can someone pls explain the problem to me..it seems that the answer is always 1/2
2012-12-09 08:35:55 Anuj_LuckFove!
AC finally... guys its a nice and a simple problem...just emphasize on the word "MAXIMIZE" the probability while writing the code for this one...

Last edit: 2012-12-09 11:40:15
2012-10-13 07:07:45 enfinet
nice problem...:)
2012-07-29 20:02:34 Secret
easy prblm....
2012-05-15 18:00:50 Vaishali Behl
Good problem! Made me apply some of the probability that we were taught in college.
2012-05-11 01:33:47 (Tjandra Satria Gunawan)(曾毅昆)
chopped to 8 decimal places = WA
rounded to 8 decimal places = AC
2012-04-05 13:03:23 time limit exceeded
nice...
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.