2023-12-12竞赛笔记

2023/12/12

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// P1192 台阶问题
#include<bits/stdc++.h>
using namespace std;
int mod=1e5+3;
int n,k,f[1000001];
int main()
{
cin>>n>>k;
f[0]=f[1]=1;//递推边界
for(int i=2;i<=n;i++)
for(int j=1;j<=k;j++)
if(i>=j)//当楼梯数大于迈步数
f[i]=(f[i]+f[i-j])%mod;

cout<<f[n]<<endl;
}