Submit | All submissions | Best solutions | Back to list |
FIBSUM - Sum of Fibonacci numbers |
Given the ith (1<=i<=35) Fibonacci number Fi calculate the sum of the ith till i+9th number Fi+Fi+1+...+Fi+9 and the last digit of the i+246th one Fi+246.
Be careful: Your solution mustn't exceed 111 bytes. But rather half of it should be more than enough.
Score is source length.
Input
In the first line the number of testcases N<=100, then N lines with one positive integer i.
Output
One line with "Fi+Fi+1+...+Fi+9+last digit of Fi+246" for each i.
Example
Input: 2
1
35 Output: 146
1821381552
Added by: | HWK |
Date: | 2011-03-25 |
Time limit: | 1s |
Source limit: | 111B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
hide comments
|
||||||
2017-07-24 14:29:25
111B? Are you kidding me??? It's impossible in c++ |
||||||
2016-01-14 01:21:50
Phew AC : 92 (python 2.7) Banged my head on the wall after more than 30 source code rejections I have seen there are solutions in C and now I am pretty sure there has to be some formula/ math behind this, otherwise it is impossible to do it in C .. Will search for the formula later.. Anyways people who have solved this in C. I bow down to you guys, you guys are the real deal.. |
||||||
2014-12-27 19:53:00 deathgun
not able to upload 105 byte python code. judge saying too long :( Damn Judge suddenly it accepts. costed me 5 WA :( Last edit: 2014-12-27 19:58:26 |
||||||
2014-10-18 09:31:40 nitish rao
112 bytes in Python.. :'( Edit: Got it! 109 it is!! Last edit: 2014-10-18 10:05:02 |
||||||
2014-06-04 19:36:09 RIVU DAS
Its hard to do in C!! |
||||||
2013-11-30 17:26:59 Carlos Eduardo Díaz Valbuena
in java it's impossible in less than 111B |
||||||
2013-11-30 17:26:59 Mostafa 36a2
$ওয়াসী (Wasi) : Congratulations :) Keep going man ;) I'm not good enough in math :p I just passed @Aditya Pande :) it seems the same formula 84 byte .. still learning and will never give up B) Last edit: 2013-08-08 21:02:42 |
||||||
2013-11-30 17:26:59 ওয়াসী (Wasi)
@Mostafa 36a2 (Al3ayesh) try this one! |
||||||
2013-11-30 17:26:59 ওয়াসী (Wasi)
44B in AWK :( EDIT: Finally 41B :D Last edit: 2013-09-06 14:13:09 |
||||||
2013-11-30 17:26:59 Ouditchya Sinha
Finally AC, good property of Fibonacci Series! :) |