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
|
||||||||||
2015-09-13 10:59:43
Got 150 in C....still not able to improve.. :-( |
||||||||||
2015-08-18 11:03:23 Ravi Chandra
453 in C++....Greatest points till now Last edit: 2015-08-18 11:13:13 |
||||||||||
2015-08-18 08:53:46
got 441 in C . Is it good enough ? |
||||||||||
2015-06-24 12:04:31 Diksha Jaiswal
237 points...nice problem sir :D |
||||||||||
2014-12-25 18:30:28 Kaushal Pranav B
Last edit: 2014-12-25 18:32:24 |
||||||||||
2014-12-19 07:21:37 Chinmaya Kumar Patanaik
I solved the problem. The series is of the form for i in [1,n]: sum += i/(i**2 +i+1)*(i**2 -i+1) But I am getting wrong answer. Please let me know where I am making a mistake. Ideone link - (http://ideone.com/DnU32c) Last edit: 2014-12-19 07:22:04 |
||||||||||
2014-10-22 10:53:53 surayans tiwari(http://bit.ly/1EPzcpv)
my score is 123 and i didn't got any points why? |
||||||||||
2014-10-04 21:58:45 Lehar
Recursion gives wrong answer in C! |
||||||||||
2014-07-02 11:58:25 tapopadma
BASIC IIT QUESTION :D Last edit: 2014-07-02 11:59:01 |
||||||||||
2014-03-25 01:46:10 Vikesh_Tiwari
got 196 points in this...:D |