RROOT - REAL ROOTS
Anurag is not so good at probability, In fact he tends to avoid any probability questions. Bhavik being his friend knows this and also knows that Anurag is excellent with quadratic equations.
In order to help he gives Anurag a quadratic equation of the form x2 + 2*b*x + c = 0 and asks him to find the probability that the given equation has real roots.
To make this question non-trivial he gives Anurag, side of the square centered at origin assuming values of b and c will not go outside that square given.
Help Anurag to find the probability?
Input
First line contains a number of test cases T (< 25). Next T lines contain the side of the square S (≤ 1000000).
Output
Output the required probability in new line for each case up to 6 decimal places.
Example
Input: 1 8 Output: 0.833333
hide comments
mallu66:
2015-08-18 16:34:57
b and c are only integers?
|
|
MishThi:
2015-08-03 04:12:48
Really good Mathematics Problem for budding programmers like me.. :P |
|
Naman Goyal:
2015-05-11 23:05:22
Easy problem. 5 mins of paper work, 5 mins of code and green light. |
|
scyth3r:
2015-05-11 08:46:27
simple and good one....
|
|
Shubham Sinha:
2015-05-03 17:41:24
Nice Problem!!!!
|
|
Dushyant Singh:
2015-04-26 13:05:29
Are square sides parallel to x and y axis? |
|
Bhavik:
2015-01-29 14:48:45
@francky,@mitch: I would like to seek your help!! I don't know how all the recent comments are deleted?? I did not do it..so kindly help me in this matter?
|
|
Flago:
2014-02-20 11:50:02
No quite sure, but this seems silly to me. Taking for expemple S=32 the ans is 0.91666666...
|
|
Shreyans:
2014-01-29 20:34:10
@Bhavik :
|
Added by: | Bhavik |
Date: | 2014-01-26 |
Time limit: | 0.300s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |