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
hide comments
:(){ :|: & };::
2013-11-30 17:26:59
@HWK: Could you please check my solution and tell me if I have hit the optimum trick? |
|
HWK:
2013-11-30 17:26:59
@XeRon!X: Congratulation!
|
|
XeRoN!X:
2013-11-30 17:26:59
I was wrong, can be solved in 99B in C :) |
|
HWK:
2013-11-30 17:26:59
@hallvabo: That's right. Changed.
|
|
germinating:
2013-11-30 17:26:59
can the source limit be increased to 140 bytes final :) |
|
Hallvard Norheim Bø:
2013-11-30 17:26:59
Example input line three (i=64) conflicts with the requirement 1<=i<=35. |
|
HWK:
2013-11-30 17:26:59
Sorry, I meant the source limit. I've corrected it.
|
|
XeRoN!X:
2013-11-30 17:26:59
Time limit is fine. I was referring to source limit only. Anyways, i'll try in some other language. |
|
HWK:
2013-11-30 17:26:59
Yes, difficult or impossible.
|
|
XeRoN!X:
2013-11-30 17:26:59
99B in C is very difficult. Consider to increase the limit. |
Added by: | HWK |
Date: | 2011-03-25 |
Time limit: | 1s |
Source limit: | 111B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |