Created
May 1, 2012 21:16
-
-
Save yuheiomori/2571467 to your computer and use it in GitHub Desktop.
CodeEval Fibonacci series
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def fib(n): | |
if n < 2: | |
return n | |
return fib(n - 1) + fib(n - 2) | |
if __name__ == '__main__': | |
test_cases = open(sys.argv[1], 'r') | |
for line in test_cases: | |
print(fib(int(line.rstrip()))) | |
test_cases.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment