题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1130
卡特兰数:https://blog.csdn.net/qq_33266889/article/details/53409553
参考文章:https://blog.csdn.net/sunshine_YG/article/details/47685737
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int base = ;
const int maxn = ;
int a[maxn+][maxn+],n,i,j;
void Init()
{
int tmp;
a[][]=;a[][]=;a[][]=;
for(i=;i<=;i++)
{
for(j=;j<;j++)
{
a[i][j]+=a[i-][j]*(*i-);
a[i][j+]+=a[i][j]/base;
a[i][j]%=base;
}
for(j=;j>=;j--)
{
tmp=a[i][j]%(i+);
a[i][j-]+=tmp*base;
a[i][j]/=(i+);
}
}
}
int main(void)
{
Init();
while(~scanf("%d",&n))
{
i=;
while(a[n][i]==) i--;
printf("%d",a[n][i--]);
while(i>) printf("%04d",a[n][i--]);
printf("\n");
}
return ;
}