链接:https://leetcode-cn.com/problems/qing-wa-tiao-tai-jie-wen-ti-lcof/
代码:
class Solution { public: int numWays(int n) { std::vector<int> vec = {1, 1}; for(int i = 2; i <= n; i++){ vec.push_back((vec[i-2] + vec[i-1])%1000000007); } return vec[n]; } };
原文地址:https://www.cnblogs.com/clown9804/p/12322502.html
时间: 2024-11-10 20:17:20