#!/bin/env python #coding:utf-8 from collections import deque import datetime
# 递归版 deffibonacci(num): if num<=2: return1 else: return fibonacci(num-1)+fibonacci(num-2)
# 迭代版 deffibonacci2(num): s=deque() result=0 for i inrange(1,num+1): if i<=2: result=1 s.append(result) else: result=s[0]+s[1] s.append(result) s.popleft() return result