标签:cli 楼梯 int tair ++ turn write code ret
class Solution {
public:
/**
* @param n: An integer
* @return: An integer
*/
int climbStairs(int n) {
// write your code here
int i,s[n];
if(n==0)
return 1;
s[0]=1;
if(n>=1)
{
s[1]=2;
for(i=2;i<n;i++)
{
s[i]=s[i-1]+s[i-2];
}
return s[n-1];
}
}
};
标签:cli 楼梯 int tair ++ turn write code ret
原文地址:http://www.cnblogs.com/1500802029xy/p/6523192.html