12345678910111213141516 |
- #!/usr/bin/env python
- fib_memo = {0:0, 1:1}
- def fib(x):
- if not x in fib_memo:
- fib_memo[x] = fib(x-1) + fib(x-2)
- return fib_memo[x]
- def main():
- for x in range(0,35):
- print fib(x)
- if __name__ == '__main__':
- import cProfile
- cProfile.run('main()')
|