脑残题,过
#include<bits/stdc++.h>
#define MAXN 2005
typedef long long ll;
using namespace std;
int n,k,f[MAXN][MAXN],g[MAXN];
int main(){
memset(f , 0 , sizeof(f));
cin>>n>>k;
f[0][0] = 1;
g[0] = 1;
for(int i = 1 ; i <= n ; i++){
for(int j = 0 ; j <= min(((i - 1) * i) >> 1 , k) ; j++){
/*for(int p = 0 ; p < i ; p++){
f[i][j] = (f[i][j] + f[i - 1][j - p]) % 10000;
}*/
f[i][j] = (g[j] - g[j - i] + 10000) % 10000;
//cout<<i<<" "<<j<<" "<<f[i][j]<<endl;
}
for(int j = 1 ; j <= min(((i + 1) * i) >> 1 , k) ; j++){
g[j] = (g[j - 1] + f[i][j] + 10000) % 10000;
}
}
cout<<f[n][k]<<endl;
}