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

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

hide comments
2015-08-18 16:34:57
b and c are only integers?
2015-08-03 04:12:48 MishThi
Really good Mathematics Problem for budding programmers like me.. :P
2015-05-11 23:05:22 Naman Goyal
Easy problem. 5 mins of paper work, 5 mins of code and green light.
2015-05-11 08:46:27 scyth3r
simple and good one....
'bout quad eqs, integration, geometric probability :D
2015-05-03 17:41:24 Shubham Sinha
Nice Problem!!!!
It took me an entire day to derive it.
But after deriving, it feels great.
2015-04-26 13:05:29 Dushyant Singh
Are square sides parallel to x and y axis?
2015-01-29 14:48:45 Bhavik
@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?
thank you
--Francky--> I didn't do it too... and I can't help on how restore old deleted comments. I only know a hack for recent deleted ones.
(Mitch) How recent were the comments? Did they contain useful info? I sometimes will delete comments that I consider useless, and since they are generic in nature I wouldn't remember which problems they belonged to unless it was very recent. Useless ones are things like "AC in the first go", "My 37th AC!!!!!!", "Use scanf/printf instead of cin/cout", "What is my error (ideone link)", "Please give a hint / more test cases", etc.
--Francky--> Like Mitch I delete same things (I don't consider them as comments), I'm sure you're asking about meaningful comments, so please be more precise about them.

Last edit: 2015-01-29 23:26:46
2014-02-20 11:50:02 Flago
No quite sure, but this seems silly to me. Taking for expemple S=32 the ans is 0.91666666...
My solution output 0.9166667 gets WA while the 0.916667 gets AC, so AC needs rounded ans to 6 decimals !?
(sorry about this if I miss understood something).

REPLY: It was clearly asked to print output upto 6 decimal digits so if you print more than 6 it will give you WA... and as for rounding off is concerned i am pretty sure you know how C/C++ stores floating point numbers and upto which precision..so any extra effort on that part was unnecessary:)

Last edit: 2014-02-21 17:07:16
2014-01-29 20:34:10 Shreyans
@Bhavik :
What is meaning of line "b and c will not go outside that square given"?
Is it like, co-ordinates of points inside square are (b,c) or any other meaning?
Is it like -side<=b,c<=side where side is length of side of square provided

RE:values of pair(b,c) will lie within or on the square given.I hope it clears your doubt..

Last edit: 2014-01-30 13:06:23
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.