跳到正文

shuyihang

919243

我不水!!!

在洛谷打开
资料、奖项与版本

资料

编号
919243
抓取
C++
#include <bits/stdc++.h>
using namespace std;
int n,k,mod=100003,dp[1000000];
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	ios::sync_with_stdio(false);
	cin.tie(0); 
	cout.tie(0);
	cin>>n>>k;
	dp[0]=dp[1]=1;
	for(int i=2;i<=n;i++){
		for(int j=1;j<=k;j++){
			if(i>=j){
				dp[i]=(dp[i]+dp[i-j])%mod;
			}
		}
	}
	cout<<dp[n]%mod;
	return 0;
}

还没有收录这位用户的文章。