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 x^2+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?


First line contains a number of test cases T(<25).Next T lines contain the side of the square S(<=1000000).


Output the required probability in new line for each case up to 6 decimal places.




hide comments
sherlock11: 2018-02-02 08:14:53

just calculate the area of parabola enclosed by upper side of square

cs_abhi2000: 2017-01-10 11:38:37

Maths Rocx... :)

(Tjandra Satria Gunawan)(曾毅昆): 2016-09-18 08:50:17

seems that S is larger than or equal 1.99503924751586370079001 in test data
try add case with S<1.99503924751586370079001 and see the magic :p

arun_1997: 2015-12-11 19:31:34

simple derivation....

thedictator: 2015-12-11 10:04:20

Simple maths problem... :)

sy_117: 2015-08-30 20:16:51

nice ques. mutliple concepts.....Nd with this completed my 50th on Spoj :P

RADHE SHYAM LODHI: 2015-08-27 19:45:08

75th ! :D

shantanu tripathi: 2015-08-22 09:58:04

nice ... @shivam singh ..no spoiler plzzz

Shivam Singh: 2015-08-21 00:22:29

for those of you who are stuck...
hint: P=1-area(Parabola)/area(Square)
intput S in double

Last edit: 2015-08-21 00:24:46
mallu66: 2015-08-18 16:34:57

b and c are only integers?

Added by:Bhavik
Time limit:0.300s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64