Submit  All submissions  Best solutions  Back to list 
FIBON  Fibonacci numbers 
Wersja polska  English version 
You are given number n and your task is to calculate nth Fibonacci number.
Input
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).
Output
For every test case print one number which is nth Fibonacci number.
Example
Input: 2
10
20
Output: 55
6765
Added by:  Piotr Kąkol 
Date:  20091220 
Time limit:  2.5s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: SCM qobi 
Resource:  Fibonacci numbers 
hide comments


20150701 13:43:23
My code is running perfectly in my editor and also in ideone but when i am submitting it, it is showing wrong answer. Can anybody tell me why? 

20141215 06:12:35 Piotr KÄ…kol
There are 70 possible tests. Perhaps you check them all? 

20141210 20:52:29 Kurt Schwind
Can someone check why I have wrong answer? 13073804 Thanks 

20141205 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. 

20141205 21:47:12 Kurt Schwind
Can someone check why I have wrong answer? 13073804 THanks 

20141018 05:42:10 Sunny
Note that Fibonacci sequence asked for here starts with 1, that is, 1 1 2 and so on... 

20140713 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 

20131121 22:55:33 Piotr KÄ…kol
@Mitch  There was no \n at the end of the test. Sorry for that. 

20131121 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: 20131121 22:59:57 

20130906 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. 