class Solution {
public:
int climbStairs(int n) {
int a = 1;
int b = 1;
int temp;
while(n>0){
n--;
temp = a;
a = b;
b += temp;
}
return a;
}
};
原文地址:https://www.cnblogs.com/theodoric008/p/9413343.html
时间: 2024-11-09 01:40:46