评测记录:https://www.luogu.com.cn/record/92994738
#include <iostream>
using namespace std;
const int maxn=1001,mod=10000;
int f[maxn][maxn];
int main()
{
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];
f[y][x]%=mod;
}
}
cout<<f[n][k];
}