Submit | All submissions | Best solutions | Back to list |
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
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
|
||||||||||
2018-10-30 20:01:16
190 with kotlin :) |
||||||||||
2018-04-28 03:49:22
128 in C++ hehe XD |
||||||||||
2018-01-14 22:40:14
135 in c |
||||||||||
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). |
||||||||||
2016-10-14 17:32:50
244 in c ! should have been better |
||||||||||
2016-09-25 11:03:15 Rafa³ Osieka
41 in Perl. I'm still trying to improve my code :) |
||||||||||
2016-08-10 04:18:53
@ Chinmaya Kumar Patanaik:Bro your code does not presize in case of 10000 9999 9998 and so on....... |
||||||||||
2016-01-10 06:54:08
76 in ruby.. Well I need some more golfing practice I guess. :/ I see people are getting happy about a score of 400+. Sir, this is a golf question and the lesser you score, the better you are. Last edit: 2016-01-10 07:09:45 |
||||||||||
2016-01-02 18:18:50
I got internal error. What that's mean? |
||||||||||
2015-10-21 02:48:18 Advitiya
481 C++ :) fast I use pow fn if WA Last edit: 2015-10-21 03:00:56 |