Shortening codes

Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

SPOJ Problem Set (main)

5642. Fibonacci numbers

Problem code: FIBON

You are given number n and your task is to calculate nth Fibonacci number.


The first line of the standard input contains one integer t (t<101) which is number of test cases.

In each of the next t lines there is one number n (n<71).


For every test case print one number which is nth Fibonacci number.



Output: 55

Added by:Piotr Kąkol
Time limit:20s
Source limit:50000B
Memory limit:256MB
Cluster: Pyramid (Intel Pentium III 733 MHz)
Resource:Fibonacci numbers

hide comments
2014-11-18 02:06:18 Varun Upadhyay
I got a green signal and a score of 159 but its not getting updated in solved problems
2014-10-18 05:42:10 Kumar Gaurav
Note that Fibonacci sequence asked for here starts with 1, that is, 1 1 2 and so on...
2014-07-13 15:29:55 avinish chandra
please have a look at my submission id 11940980,don't know why is it giving tle while working on my pc perfectly fine
2013-11-21 22:55:33 Piotr Kąkol
@Mitch - There was no \n at the end of the test. Sorry for that.
2013-11-21 22:19:04 Mitch Schwartz
Is the input file badly formatted? I submitted two BF solutions, the first assuming "\n" newlines and the second assuming "\r\n", and both got TLE, while on my testing problem on Pyramid that same code got AC in 0.54s for an input file with t=100 and test cases (1, 2, ... , 69, 70, 70, ...). I do assume that the last line is terminated with a newline.

Edit: Whoops, my second submission is assuming "\n\r"... I'll rewrite that.

Edit 2: Still TLE...

@Piotr: Thanks! I guess omitting the last newline isn't really bad formatting, but it's usually right to assume that the newline is there, and of course matters a lot for BF. :)

Last edit: 2013-11-21 22:59:57
2013-09-06 20:27:05 Jander
@challenger/Piotr - kinda the wrong place to accept the praise, but yeah! I'm very pleased with BF_PRIME. I wanted to get below 140 as that's a better than 2:1 ratio code:output.
2013-09-06 18:48:38 challenger
@ওয়াসী (Wasi) - Happy to have encouraged you. :-) Good job! Also, I like your attitude. :-)

@hendrik - You're right, I'm Piotr. I'm submitting it from a different account as I don't want glory for my name but to minimize the sum of the best solutions in all languages in all tasks.

@Pranab Kumar - Imo it's quite easy to spot having to check only 70 numbers. On polish SPOJ I wouldn't answer, but here I will: for n=1 you print 0.

@Jander - Amazing job with BF_PRIME. Couldn't believe that. ;-)

Last edit: 2013-09-06 18:50:19
2013-09-06 10:41:06 ওয়াসী (Wasi)
@challenger reached 33B! Thanks for the motivation.

@hendrik It doesn't really matter to me if he does it seeing solutions or any other way. I just love to shorten codes its full of fun :D

Last edit: 2013-09-06 14:10:41
2013-09-06 09:39:19 Jander
@hendrik - you would be right in that belief. Challenger does it to make people try that little bit harder :-)
2013-09-06 08:37:09 hendrik
@Wasi: I wouldnt praise challenger too much as he can see the solutions of problems added by Piotr. I think they are one and the same.
© All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.