算出前几项就可以找到此规律
class Solution { public: int jumpFloor(int number) { int a[10010]; a[0] = 0, a[1] = 1, a[2] = 2; for ( int i = 3; i < 10010; i++ ) a[i] = a[i-1] + a[i-2]; return a[number]; } };
算出前几项就可以找到此规律
class Solution { public: int jumpFloor(int number) { int a[10010]; a[0] = 0, a[1] = 1, a[2] = 2; for ( int i = 3; i < 10010; i++ ) a[i] = a[i-1] + a[i-2]; return a[number]; } };