libreoj10018
题解:我们定义dp[i][j]为前i个数分为j组的方案数,那么dp[i][j[=dp[i-1][j-1]+dp[i-j][j](其实就是将末尾的那个数分为是否自己成为一组)
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL maxn=205;
const LL mod=911451407;
int n,k;
int dp[maxn][7];
int main()
{
int n,k;
cin>>n>>k;
//dp[1][1]=1;
for(int i=1;i<=n;i++){
for(int j=1;j<=k&&j<=i;j++){
if(i==j){
dp[i][j]=1;
}
else{
dp[i][j]=dp[i-1][j-1]+dp[i-j][j];
}
}
}
printf("%d\n",dp[n][k]);
return 0;
}