题目链接:

  http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1789

题目大意:

  求大卡特兰数。。公式如下。输入n求Sn(n<=5000)

题目思路:

  【高精度】

  Sn=Cn+1。直接压四位高精度算一遍就好。只要写高精度乘单精度,高精度除单精度。

 //
//by coolxxx
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<memory.h>
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//#include<stdbool.h>
#include<math.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(a) ((a)>0?(a):(-(a)))
#define lowbit(a) (a&(-a))
#define sqr(a) ((a)*(a))
#define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
#define mem(a,b) memset(a,b,sizeof(a))
#define eps (1e-8)
#define J 10000
#define mod 1000000007
#define MAX 0x7f7f7f7f
#define PI 3.14159265358979323
#define N 20004
using namespace std;
typedef long long LL;
int cas,cass;
int n,m,lll,ans;
int a[N];
void gjdchengdjd(int a[],int b)
{
int i;
for(i=;i<=a[];i++)
a[i]*=b;
for(i=;i<=a[];i++)
a[i+]+=a[i]/J,a[i]%=J;
while(a[a[]+])a[]++;
}
void gjdchudjd(int a[],int b)
{
int i;
for(i=a[];i>;i--)
a[i-]+=(a[i]%b)*J,a[i]/=b;
a[]/=b;
while(!a[a[]] && a[]>)a[]--;
}
void gjdprint(int a[])
{
int i;
printf("%d",a[a[]]);
for(i=a[]-;i;i--)
printf("%04d",a[i]);
puts("");
}
int main()
{
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
// freopen("2.txt","w",stdout);
#endif
int i,j,k;
int x,y,z;
// for(scanf("%d",&cass);cass;cass--)
// for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
// while(~scanf("%s",s+1))
while(~scanf("%d",&n))
{
n++;
a[]=a[]=;
for(i=n+;i<=n+n;i++)
gjdchengdjd(a,i);
for(i=;i<=n+;i++)
gjdchudjd(a,i);
gjdprint(a);
}
return ;
}
/*
// //
*/

【高精度】NCPC 2014 C catalansqure的更多相关文章

  1. 【动态规划】【缩点】NCPC 2014 G Outing

    题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1793 题目大意: 一辆公交车,上面M个座位,N个人(M<=N<=1000) ...

  2. 【KMP】【最小表示法】NCPC 2014 H clock pictures

    题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1794 题目大意: 两个无刻度的钟面,每个上面有N根针(N<=200000),每个 ...

  3. 【图论】【宽搜】【染色】NCPC 2014 A Ades

    题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1787 题目大意: N个点M条无向边(N,M<=200000),一个节点只能有一个 ...

  4. 【模拟】NCPC 2014 E ceremony

    题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1791 题目大意: N栋大楼(N<=100000),拆除的时候有两种选择的操作,可 ...

  5. 【模拟】NCPC 2014 D Dice Game

    题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1790 题目大意: 两个人,每个人有两个骰子,每个骰子可以等概率取[a,b],问哪个人两 ...

  6. 【模拟】NCPC 2014 K Train passengers

    题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1797 题目大意: 有N个车站,火车一共可以坐M个人,每个车站下车Ai,上车Bi个人,在 ...

  7. CodeForcesGym 100502E Opening Ceremony

    Opening Ceremony Time Limit: 5000ms Memory Limit: 524288KB This problem will be judged on CodeForces ...

  8. CodeForcesGym 100502D Dice Game

    Dice Game Time Limit: 1000ms Memory Limit: 524288KB This problem will be judged on CodeForcesGym. Or ...

  9. CodeForcesGym 100502H Clock Pictures

    Clock Pictures Time Limit: 1000ms Memory Limit: 524288KB This problem will be judged on CodeForcesGy ...

随机推荐

  1. linux下面安装和配置nginx

    下载nginx-1.0.2.tar.gz wget nginx-1.0.2.tar.gz 解压 nginx-1.0.2.tar.gz tar -xzvf nginx-1.0.2.tar.gz 配置安装 ...

  2. 微信分享 分享icon和分享标题的简单设置

    前几天做的一个活动,用到微信分享功能,分享的icon.分享的标题和内容是自定义的.我上网查了一下,好多是注册微信公众号,使用微信api来实现的,注册微信号比较麻烦,最简单的方法就是 页面的title改 ...

  3. SQL拾遗

    前两天同事问了个SQL问题,有个出价记录表[针对不同拍品出价],每个人都可以多次出价,要查下哪些拍品出价最高的人和出价次高的人是同一个人的记录,当时写了下面的SQL,今天先记下了,欢迎补充新的查询方式 ...

  4. ssh框架配置事务管理器

    http://blog.163.com/zsq303288862@126/blog/static/9374596120111182446727/

  5. angularjs 利用filter进行表单查询及分页查询

    页面: <div> <input style="width:90%;margin-left:5px;margin-right:5px;" class=" ...

  6. 11g 创建asm磁盘组

    [root@Oracle11g ~]# fdisk -l Disk /dev/sda: 21.4 GB, 21474836480 bytes255 heads, 63 sectors/track, 2 ...

  7. delegate-使用笔记

    public class testclass { public class ProductImages : Page { protected Repeater rptSmallUrls; protec ...

  8. Spring_DI利用set方法赋值Demo

    Person.java public class Person { private Long pid; private String pname; private Student student; p ...

  9. 谈一下关于C++函数包装问题

    在C++中,我们经常遇到在某个特定的时刻,需要将函数进行包装调用,尤其是当我们需要将不同签名的函数放到同一个集合时,由于函数签名不一致导致我们不能直接将各式各样的函数指针放到诸如list这样的集合中, ...

  10. C++序列化库的实现

    C++中经常需要用到序列化与反序列化功能,由于C++标准中没有提供此功能,于是就出现了各式各样的序列化库,如boost中的,如谷歌的开源项目,但是很多库都依赖其他库过于严重,导致库变得很庞大.今天来分 ...