M_SEQ - Mosty! Find Gn

Omar want to examine Mostafa in math, Mostafa asked to give G(n) that defined as:

G(n) = sqrt( F(n) - ( (n-1)^2 * F(n-1) / n^2 ) + 1/n^2 )

while:

F(n) = 8 + ( ((n-2)^2 )*(F(n-2)) /n^2 )

Mostafa need your help to find G(n) (n : given integer)

assume that : F(1) = 8, F(2) = 8;

Input

T number of test cases in the first line, T line follow with an integer n.

Output

Print G(n) for each test case with 8 decimal digits after the point (0 < G(n) < 3)

Example

Input:
3
5
7
42
Output: 2.20000000 2.14285714 2.02380952

Constraints

T < 10^4
2 < n < 10^9


Added by:omar alkattan
Date:2013-02-20
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:own

hide comments
2014-01-06 18:52:03 Sir_Ostara
Beautiful..

Last edit: 2014-01-06 18:52:46
2013-06-20 12:02:58 Mitch Schwartz
My old code got 0.00s again when I resubmitted it.

problem sitter : i think in some conditions , testing take more or less time by one or two milliseconds "0.00x"
:)

Last edit: 2013-06-20 16:45:23
2013-06-17 12:24:51 wisfaq
Personally I miss the point of rejudging this problem.
However, I can hardly imagine that the rejudging had any effect at all if the constraints are indeed the same.
So I think there is no use of making fuss about a meaningless action

Problem Sitter : IO edited in 24/2/2013 ( problem sitted in 20/2/2013).
rejudged for first best solutions .
all your submits have same results

Last edit: 2013-06-17 19:29:03
2013-06-16 14:47:13 omar alkattan
All submits have been rejudged
but the problem still have same constraints
--ans(francky)--> It's pretty unfair to do so, please never do it again !!! Even if you have the same constraints, did you note people who lost their AC, or other who get AC now ? You should PM them...
Have you any reason for that action?
Please consider that most of us worked on this problem several months ago. A problem must be ready before put in main problem set.
--(edit, francky)--> Moreover I wonder if I should hide this problem until original IO files are back and rejudge done. I'm waiting for other comments. Again, it's a very bad idea.

Omar Alkattan : Sorry , but the IO files are edited after sitting the problem by about 3 days (same but with more test cases) .
the rejudging done for rearrange the best solutions menu .
no unaccepted solution have AC after this.
12 accepted solutions have TLE , and most of them have other AC solutions ...
this decision came after numerix solution in pascal take 0.00 ... i think it's distinctive
thanks :)

--ans(Francky)--> Ho, in those conditions, there's no many troubles, I thought you changed IO files recently. OK.

Last edit: 2013-06-17 21:26:49
2013-03-13 07:13:39 checks
Getting TLE. Any suggestions. Using one for loop inside the TC loop of while.
Using scanf.
2013-02-21 05:42:16 (Tjandra Satria Gunawan)(曾毅昆)

by setter : sorry tjandra can't allow spoils .
EDIT(by Tjandra): Sorry, I don't know that such information is spoil... For this kind of easy problem, I like to golf it :-D

Last edit: 2013-02-28 16:10:47
2013-02-20 15:49:16 Francky
Answer have to be rounded, not truncated! (It is unspecified in description, but I agree that it's obvious).
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.