IEEEBGAM - The Ball Game

no tags 

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

hide comments
nai)(: 2013-05-04 09:38:21

Emphasize on "MAXIMIZE" rest is esay :D

raunakrocks: 2013-02-04 21:04:49

esy1....:)

Kevin Sebastian: 2013-01-22 03:46:26

can someone pls explain the problem to me..it seems that the answer is always 1/2

Anuj_LuckFove!: 2012-12-09 08:35:55

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
enfinet: 2012-10-13 07:07:45

nice problem...:)

Secret: 2012-07-29 20:02:34

easy prblm....

Vaishali Behl: 2012-05-15 18:00:50

Good problem! Made me apply some of the probability that we were taught in college.

(Tjandra Satria Gunawan)(曾毅昆): 2012-05-11 01:33:47

chopped to 8 decimal places = WA
rounded to 8 decimal places = AC

time limit exceeded: 2012-04-05 13:03:23

nice...


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