Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
||||||
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 |
||||||
2015-02-20 04:11:30 Krishna Mohan
When the answer is 1 print "1". printing "1.0" gives WA |
||||||
2015-01-10 15:12:56 Anubhav Gupta
simple logic, but getting tle in java |
||||||
2013-12-11 21:12:46 Shivam Dimri
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.. |
||||||
2012-12-24 05:07:33 Aviral Jain
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 |
||||||
2012-09-13 19:58:43 Mahmoud Aladdin
@numerix: printing that long string gives me a NZEC in my solution!! |
||||||
2012-09-12 21:28:23 numerix
@Mahmoud Aladdin: True. |
||||||
2012-09-12 16:58:11 Mahmoud Aladdin
@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?! |
||||||
2012-09-07 17:07:06 numerix
@Mahmoud Aladdin: As it says in the description: "print all digits", i.e. the exact value. |
||||||
2012-09-07 13:53:27 Mahmoud Aladdin
Please clarify the format of the output! |