摘要:
斐波那契数列的变形,用递归会过不了large judge。所以采用另外一种方法。class Solution {public: int climbStairs(int n) { if(n==0)return 1; if(n==1)return 1; int a=1; int b=1; int c; for(int i=2;i<=n;i++) { c=a+b; a=b; b=c; } return c... 阅读全文
posted @ 2013-05-10 22:47
代码改变未来
阅读(240)
评论(0)
推荐(0)