标签:重叠 stream code cin desc item ace class des
1 #include <iostream> 2 using namespace std; 3 4 class Solution { 5 public: 6 int rectCover(int number) { 7 //边界条件 8 int f[number]; 9 if (number <= 0) return 0; 10 f[0] = 1; 11 f[1] = 2; 12 13 for (int i = 2; i < number; i++) { 14 f[i] = f[i - 1] + f[i - 2]; 15 } 16 return f[number - 1]; 17 } 18 }; 19 20 int main() { 21 Solution s; 22 int number; 23 while(cin >> number) { 24 cout << s.rectCover(number) << endl; 25 } 26 return 0; 27 }
标签:重叠 stream code cin desc item ace class des
原文地址:https://www.cnblogs.com/gousheng/p/9372793.html