FERT21_0 - Matches


Upon a table there are two boxes. Each box has N matches inside. We want to know what is the probability of choose N times a random box and take one match from it, at the end have an empty box.

You have to print all digits.

Constraints
1 <= T <= 1000
1 <= N <= 1000

Input

T
N1
N2
...
NT

Output

P1
P2
...
PT

Example

Input:
1
2

Output:
0.5

hide comments
mahilewets: 2017-09-02 21:35:56

decimal. getcontext (). prec=1<<14

This is not TLE

So you should not be afraid to have some additional precision
You don't pay for it much

Krishna Mohan: 2015-02-20 04:11:30

When the answer is 1 print "1".
printing "1.0" gives WA

Anubhav Gupta: 2015-01-10 15:12:56

simple logic, but getting tle in java

Shivam Dimri: 2013-12-11 21:12:46

no matter how hard i try always getting tle!! even after optimizing the code, big integer handling and manipulation isn't possible in c++, had the code been written in java then maybe the problem would have been much simplified..

Aviral Jain: 2012-12-24 05:07:33

can it have any ans different from 0.5???
we can only choose a box at first choice then we have to choose the same box to get an empty box... please correct me if iam wrong???
...thanks

Last edit: 2012-12-24 05:08:45
Mahmoud Aladdin: 2012-09-13 19:58:43

@numerix: printing that long string gives me a NZEC in my solution!!

numerix: 2012-09-12 21:28:23

@Mahmoud Aladdin: True.

Mahmoud Aladdin: 2012-09-12 16:58:11

@numerix: I used to output the exact value, where my answer got a NZEC. and IDEONE also NZEC for reaching the maximum output file size. So, don't know what exactly is wanted, as my answer for 1000 is 1001 characters long. Is that true?! or?!

numerix: 2012-09-07 17:07:06

@Mahmoud Aladdin: As it says in the description: "print all digits", i.e. the exact value.

Mahmoud Aladdin: 2012-09-07 13:53:27

Please clarify the format of the output!


Added by:leandro
Date:2010-03-03
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: JS-RHINO OBJC SQLITE
Resource:own problem