赞
踩
题目:
题解:
- class Solution {
- public:
- int climbStairs(int n) {
- double sqrt5 = sqrt(5);
- double fibn = pow((1 + sqrt5) / 2, n + 1) - pow((1 - sqrt5) / 2, n + 1);
- return (int)round(fibn / sqrt5);
- }
- };
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。