TOHU - Help Tohu
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
Input
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.
Output
For each n output the value with 11 digits after decimal point.
Example
Input:
2
2
5
Output: 0.70833333333
0.73809523810
hide comments
cjn2007:
2021-10-29 07:57:09
AC in one go! |
|
nabil_fikr:
2021-03-31 15:55:29
oalahh ez |
|
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 |
Added by: | Efim |
Date: | 2011-06-15 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |