SUMUP - Sum the Series

Nilendu is a brilliant student of Mathematics and always scores A+ in it. His professor RamjiLal is quite impressed seeing his mathematical skills and asks him to sum the following series:

1/3 + 2/21 + 3/91 + 4/273 + .....

But the fact is Nilendu is quite lazy to do his assignment. He has to watch a film and many other activities to do. So he asks you for your help. Will you be able to solve it ??

Input

Input consists of t (number of test cases), then t line follows, each containing an integer N (1 <= N <= 10,000).

Output

A single line containing the sum upto Nth integer (rounded upto 5 digits)

Example

Input:
5
1
2
3
4
5

 Output: 0.33333
0.42857
0.46154
0.47619
0.48387

Edit: The score is your source length. The smaller your code is, the more point you will get. All the solutions have been rejudged !!!

Added by:Better late than never !!!
Date:2012-06-20
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:RamjiLal Sir

hide comments
2013-08-01 02:20:32 Mostafa 36a2
@Mitch have a look :)
2013-07-31 09:40:04 ওয়াসী (Wasi)
wonder how to cut a byte off from my formula!
2013-07-30 23:34:45 Mostafa 36a2
I think this should be moved to riddle section !
But maybe it's easy for riddle ,good for Challenge :p

Last edit: 2013-07-31 02:00:07
2013-07-30 18:41:02 pranjuldb
easy problem, just need to find general term... !!!!!
2013-05-25 06:57:34 XeRoN!X
Looks like judge is broken, my 36 B solution shows 0 as score.
--ans(francky)--> Info reported to admin. And I confirm the bug, my python solution gave me a 0 score too... (I disqualified it after the test).

Re( xeronix ): It's fixed now but rejudge is required, i've sent a mail to admin with list of problems affected which need rejudging.

Last edit: 2013-05-24 18:39:58
2013-05-25 06:57:34 Mitch Schwartz
@Dominique: Yes, that's not a bug, the problem setter just chose to "Merge all languages in ranklist" so that only a user's top submission would be displayed in the overall rank list. And I've submitted my Ruby solution (which I wrote at the same time as Python but didn't bother submitting then because it wasn't an improvement over Python) to give you some motivation to save a byte. :)
2013-05-25 06:57:34 Dominique VAILLANT
Comparing these two links:
http://www.spoj.com/ranks/SUMUP/start=20
http://www.spoj.com/ranks/SUMUP/lang=PYTH%202.7
we see that the results of 53 for Mitch Schwartz and numerix
doesn't appear in the first one (all languages).

@Mitch: Thanks for your response. Very motivating indeed!

Last edit: 2013-05-12 04:03:14
2013-05-25 06:57:34 Anuj_LuckFove!
Removed after AC!

Last edit: 2013-01-10 10:46:54
2013-05-25 06:57:34 Cain
input:
3
315
316
1000
output:
0.49999
0.50000
0.50000
2013-05-25 06:57:34 K.P.
output..?
315
316
1000

Last edit: 2012-11-28 16:12:07
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.