找规律大法80分求助,#8,#9 wa
查看原帖
找规律大法80分求助,#8,#9 wa
322717
vix_hentx楼主2022/11/6 09:47

评测记录:https://www.luogu.com.cn/record/92994738

#include <iostream>
using namespace std;
const int maxn=1001,mod=10000;
int f[maxn][maxn];
int main()
{
//	freopen("P2513.out","w",stdout);
	int n,k;
	cin>>n>>k;
	int p,q;
	for(int i=0;i<n;i++)f[i+1][1]=i,f[i+1][0]=1;
	for(int y=3;y<=n;y++)
	{
		for(int x=2;x<=k;x++)
		{
			p=x-y,q=y-1;
			if(p<0)f[y][x]=f[y-1][x]+f[y][x-1];
			else f[y][x]=f[y-1][x]+f[y][x-1]-f[q][p];
//			if(f[y][x]<0)f[y][x]=0;
			f[y][x]%=mod;
		}
	}
	cout<<f[n][k];
}
2022/11/6 09:47
加载中...