题目链接:http://wikioi.com/solution/list/1401/
题解链接:http://user.qzone.qq.com/619943612/blog/1377265690
代码:
#include <iostream> #include <cstdio> #include <cstring> using namespace std; short int N,K,f[101][10001]; int main(){ cin>>N>>K; f[1][1]=1; for (int i=2;i<=N;i++) for (int k=1;k<=N+K;k++) for (int j=1;j<=i;j++) if (k-j>=1) f[i][k]=(f[i][k]+f[i-1][k-j])%10000; else break; cout<<f[N][N+K]; return 0; }