标签:
1 class Solution { 2 public: 3 int jumpFloor(int number) { 4 if(number<=1) 5 return number; 6 int target=0; 7 int first=1; 8 int second=1; 9 for(int i=2;i<=number;++i) 10 { 11 target=first+second; 12 first=second; 13 second=target; 14 } 15 return target; 16 } 17 };
1 class Solution { 2 public: 3 int jumpFloor(int number) { 4 if(number<=0) 5 return 0; 6 else 7 return 1<<(number-1); 8 } 9 };
标签:
原文地址:http://www.cnblogs.com/lou424/p/5038630.html