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:2.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel Pentium G860 3GHz)
Languages:All except: SCM chicken SCM qobi
Resource:Fibonacci numbers

hide comments
2014-12-15 06:12:35 Piotr KÄ…kol
There are 70 possible tests. Perhaps you check them all?
2014-12-10 20:52:29 Kurt Schwind
Can someone check why I have wrong answer? 13073804 Thanks
2014-12-05 21:49:47 Kurt Schwind
Also, is there a place where people are discussing tips/tricks? I noticed that on some problems I need newlines between answers and other times spaces. And I'm not sure what's really available on the remote system if I use bash (can I count on bc?) I tried to jump over to the forum but the Captcha seems broken.
2014-12-05 21:47:12 Kurt Schwind
Can someone check why I have wrong answer? 13073804 THanks
2014-10-18 05:42:10 Sunny
Note that Fibonacci sequence asked for here starts with 1, that is, 1 1 2 and so on...
2014-07-13 15:29:55 black MaMbA
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
© All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.