且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

shu_1016 栈

更新时间:2022-09-14 22:17:39

http://202.121.199.212/JudgeOnline/problem.php?cid=1079&pid=2


分析: Catalan数的应用,直接用了Catalan数的递推公式之中的一个


代码:

#include <iostream>
#include <stdio.h>
using namespace std;
 
long long f[20];
void init()
{
    f[0]=f[1]=1;
    for(int i=2;i<=18;i++){
        f[i]=f[i-1]*(4*i-2)/(i+1);
        //cout<<f[i]<<endl;
    }
}
 
int main()
{
    init();
    int n;
    scanf("%d",&n);
    printf("%lld\n",f[n]);
}






本文转自mfrbuaa博客园博客,原文链接:http://www.cnblogs.com/mfrbuaa/p/5400459.html,如需转载请自行联系原作者