当前位置:网站首页>Sword finger offer 10- ii Frog jumping on steps
Sword finger offer 10- ii Frog jumping on steps
2022-06-11 08:43:00 【zmm_ mohua】
The finger of the sword Offer 10- II. The problem of frog jumping on the steps
subject

Code
#include <iostream>
#include <vector>
using namespace std;
int numWays(int n) {
if(n == 0 || n == 1){
return 1;
}
vector<int> dp(n);
dp[0] = 1;
dp[1] = 2;
for(int i = 2; i < n; i++){
dp[i] = dp[i-1] + dp[i-2];
dp[i] %= 1000000007;
}
return dp[n-1];
}
int main(){
int n, res;
cin>>n;
res = numWays(n);
cout<<res;
return 0;
}
边栏推荐
猜你喜欢

Hibernate L2 cache

go for it Easily manage all types of items with "flying items"

剑指 Offer 10- II. 青蛙跳台阶问题

What does it mean to buy a single-mode, dual-mode and Rechargeable Wireless Mouse

mysql高级特性篇,可以多看看,应付面试

Redis6 entry-level tutorial. There are integration cases. You can directly see the integration cases. It is easy to get started

Web design and website planning assignment 12 online registration form

你所不知道的console

Oracle learning (I)

盘它!用「飞项」轻松管理各类型项目
随机推荐
[software tool] the hacker matrix special effect software CMatrix
Zookepper===>动物管理员系统
Codeworks round 680 div2
ICML2022有意思的文章
leetcode - 518. 零钱兑换 II
Js学习基础document.write在页面中写一行文字
你所不知道的console
Solve notimplementederror: layer XX has arguments in`__ init__` and therefore must override `get_ config`
Multiple limit of the same field of SQL
Qiao lerna: lerna auxiliary tool
GO语言:字符串的连接、数字转化字符串
Not eligible for getting processed by all beanpostprocessors
【node】npm部分
怎么做好项目管理?学会这4个步骤就够了
Swagger study notes
CentOS essay 03:centos8.2 installing MySQL
Use of Excel to XML tool of TestLink
剑指 Offer 62. 圆圈中最后剩下的数字
SSM file upload and download
How CSDN reports plagiarized articles