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: 5Edit: The score is your source length. The smaller your code is, the more point you will get. All the solutions have been rejudged !!!
1
2
3
4
5
Output: 0.33333
0.42857
0.46154
0.47619
0.48387
hide comments
seyed_8610303:
2018-10-30 20:01:16
190 with kotlin :) |
|
ilham_ti2017:
2018-04-28 03:49:22
128 in C++ hehe XD |
|
pratapvidhu_17:
2018-01-14 22:40:14
135 in c |
|
dcirkveni2020:
2017-03-05 18:12:16
210 in C. It helps if you filter \n and \t from the code (except for the beginning \n and the one printing). |
|
satyabrat35:
2016-10-14 17:32:50
244 in c !
|
|
Rafa³ Osieka:
2016-09-25 11:03:15
41 in Perl. I'm still trying to improve my code :) |
|
abhinav_gaur:
2016-08-10 04:18:53
@ Chinmaya Kumar Patanaik:Bro your code does not presize in case of
|
|
dwij28:
2016-01-10 06:54:08
76 in ruby.. Well I need some more golfing practice I guess. :/
|
|
a_v_a_t_a_r:
2016-01-02 18:18:50
I got internal error. What that's mean? |
|
Advitiya:
2015-10-21 02:48:18
481 C++ :) fast I
|
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 |