很久没见到这么神的处理方法了,纪念一下!
n比较小时n<=30,用f(n)=f(n-1)+f(n-2),n>=2求解
n比较大时使用进似计算的通式f(n)=x^n ,x=(1+sqrt(5))/2 , (n<10^10)
巧妙之处在于计算x^n
参考:http://hi.baidu.com/racebug/blog/item/54ad34ed3c3dfc3426979191.html
很久没见到这么神的处理方法了,纪念一下!
n比较小时n<=30,用f(n)=f(n-1)+f(n-2),n>=2求解
n比较大时使用进似计算的通式f(n)=x^n ,x=(1+sqrt(5))/2 , (n<10^10)
巧妙之处在于计算x^n
参考:http://hi.baidu.com/racebug/blog/item/54ad34ed3c3dfc3426979191.html