TOHU - Help Tohu

no tags 

Tohu wants to enter Moscow State University, and he must pass the math exam. He does not know math, and asks you to help him. The problem is to find the sum of the sequence on condition


First line contains single integer T <= 20000 - the number of test cases.

Each of the next T lines contains single integer 1 <= n <= 10^9.


For each n output the value with 11 digits after decimal point.



Output: 0.70833333333

hide comments
pandey101299: 2019-04-15 23:19:15

first find nth term then genralize sn

deependra_18: 2019-01-03 06:37:03

for ans match take 0.50 intialy as a sum

markaman: 2018-12-07 13:15:47

Pure mathematics :)

vivek_dwivedi: 2018-06-26 12:30:16

IIT-JEE math's. Memories ;)

ankush: 2017-05-29 19:42:44

ac in one go easy

cake_is_a_lie: 2017-04-03 15:35:27

When math fails you, put your trust in engineering: there is no need for an O(1) formula for Sn; just O(1) formula for An and solid engineering for 0.01s :-)

vineetpratik: 2016-06-22 11:00:30

try to find ak and then apply summation to get formula O(1)

sneh sajal: 2015-12-18 10:24:54

@ dashingvimeet: output is right!! actually the formula which u are getting is valid for k>=2.we need to take care of k=1 in the summation!

shikhar: 2015-07-24 12:38:36

i did the maths but could not find the expression

dashingvimeet: 2015-07-13 16:29:00

By mathematical induction, we found a[sub]1[/sub] and a[sub]2[/sub] as 1 / 6 and 1 / 24 respectively, therefore S[sub]2[/sub] came out to be 0.208333333333. Output shown above is wrong.

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