链接:HDU 1023

/****************************************
* author : Grant Yuan
* time : 2014/10/19 15:51
* source : HDU 1023
* algorithm : Catalan数+高精度
* ***************************************/
import java.io.*;
import java.math.*;
import java.util.*;
public class Main{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
BigInteger []a = new BigInteger [105];
BigInteger t;
a[0]=a[1]=BigInteger.ONE;
for(int i=2;i<=102;i++)
{
a[i]=a[i-1].multiply(BigInteger.valueOf(4*i-2)).divide(BigInteger.valueOf(i+1));
}
while(cin.hasNext()){
int n=cin.nextInt();
if(n==-1) break;
String str;
str=a[n].toString();
System.out.println(str);
}
}
}

HDU 1023 Catalan数+高精度的更多相关文章

  1. hdu 1023 卡特兰数+高精度

    Train Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  2. POJ 2084 Catalan数+高精度

    POJ 2084 /**************************************** * author : Grant Yuan * time : 2014/10/19 15:42 * ...

  3. BZOJ 2822: [AHOI2012]树屋阶梯 [Catalan数 高精度]

    2822: [AHOI2012]树屋阶梯 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 779  Solved: 453[Submit][Status] ...

  4. Train Problem II HDU 1023 卡特兰数

    Problem Description As we all know the Train Problem I, the boss of the Ignatius Train Station want ...

  5. HDU 1023(卡特兰数 数学)

    题意是求一列连续升序的数经过一个栈之后能变成的不同顺序的数目. 开始时依然摸不着头脑,借鉴了别人的博客之后,才知道这是卡特兰数,卡特兰数的计算公式是:a( n )  =  ( ( 4*n-2 ) / ...

  6. BZOJ 3907: 网格 [Catalan数 高精度]

    3907: 网格 Time Limit: 1 Sec  Memory Limit: 256 MBSubmit: 402  Solved: 180[Submit][Status][Discuss] De ...

  7. hdu 1023 卡特兰数《 大数》java

    Train Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  8. HDU 1023 Train Problem II 大数打表Catalan数

    一个出栈有多少种顺序的问题.一般都知道是Catalan数了. 问题是这个Catalan数非常大,故此须要使用高精度计算. 并且打表会速度快非常多.打表公式要熟记: Catalan数公式 Cn=C(2n ...

  9. HDU 4828 - Grids (Catalan数)

    题目链接 : http://acm.hdu.edu.cn/showproblem.php?pid=4828 Catalan数的公式为 C[n+1] = C[n] * (4 * n + 2) / (n ...

随机推荐

  1. x264介绍

    x264 编辑   H.264是ITU(International Telecommunication Unite 国际通信联盟)和MPEG(Motion Picture Experts Group ...

  2. C++中const与constexpr区别

    对于对象来说 const指的是编译期常量和运行时常量,两者并没有区分 constexpr特指编译期常量 对于函数来说 const可以修饰类的成员函数,被修饰的函数在执行期间不会改变对象的值. clas ...

  3. 树莓派 - RPi.GPIO

    RPi.GPIO是通过Python/C API实现的,C代码操作底层寄存器, python通过Python/C API调用这些C接口. 这是关于RPi.GPIO项目的介绍. 其中提到了有python ...

  4. 第二十二节:scrapy爬虫识别验证码(一)类库安装

    一.安装tesserocr 1.首先下载tesseract:https://digi.bib.uni-mannheim.de/tesseract/ ,我下载的是tesseract-ocr-setup- ...

  5. C51 使用端口 个人笔记

    使用整个端口的8个引脚: 八个引脚,需要8位2进制,2位十六进制 #define P0 led led = 0x3f; //led = ~0x3f; 使用某个端口的某一个引脚 sbit led = P ...

  6. spark streaming 踩过的那些坑

      系统背景 spark streaming + Kafka高级API receiver 目前资源分配(现在系统比较稳定的资源分配),独立集群 --driver-memory 50G   --exec ...

  7. [luoguP1489] 猫狗大战(DP)

    传送门 类似背包的做法. f[i][j]表示是否能放i个物品,价格为j #include <cstdio> #include <iostream> #define N 8001 ...

  8. Github上600多个iOS开源项目分类及介绍

    将Github上600多个iOS开源项目进行分类并且有相应介绍,小伙伴们快来看呀 地址:http://github.ibireme.com/github/list/ios/

  9. 【NOIP2016】蚯蚓(单调队列)

    题意: 思路: 我们发现,对于任意两次切割i和j,i<j,在进行完第j次切割后,第i次切割的u/v部分一定大于等于第j次切割的u/v部分,第i次的1-u/v部分也一定大于等于第j次的1-u/v部 ...

  10. openstack setup demo Enviroment

    Enviroment 本文包含以下部分. Host networking Network Time Protocol (NTP) OpenStack packages SQL database NoS ...