短小精悍的代码
dp[i][j] +=dp[k][j-1]*[i-k-1][j-1] i个结点 J层
#include <iostream>
#include<cstdio>
#include<cstring>
#include<stdlib.h>
#include<algorithm>
using namespace std;
#define LL __int64
LL dp[][];
int main()
{
int i,j,k,n,d;
scanf("%d%d",&n,&d);
for(i = ; i <= n ; i++)
dp[][i] = ;
for(i = ; i <= n ; i++)
{
for(j = ; j <= n ; j++)
{
for(k = ; k < i ; k++)
dp[i][j]+=dp[k][j-]*dp[i-k-][j-];
}
}
printf("%I64d\n",dp[n][n]-dp[n][d-]);
return ;
}