标签:
class Solution {
public:
int jumpFloor(int number) {
long long fiboncciA = 1;
long long fiboncciB = 2;
if (number == 1){
return fiboncciA;
}
if (number == 2) {
return fiboncciB;
}
int i;
for (i = 3; i <= number; i++){
int tmp = fiboncciB;
fiboncciB = fiboncciA + fiboncciB;
fiboncciA = tmp;
}
return fiboncciB;
}
};
下一题
标签:
原文地址:http://www.cnblogs.com/code-changeworld/p/4531367.html