Train Problem II

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7918    Accepted Submission(s):
4241

Problem Description
As we all know the Train Problem I, the boss of the
Ignatius Train Station want to know if all the trains come in strict-increasing
order, how many orders that all the trains can get out of the railway.
 
Input
The input contains several test cases. Each test cases
consists of a number N(1<=N<=100). The input is terminated by the end of
file.
 
Output
For each test case, you should output how many ways
that all the trains can get out of the railway.
 
Sample Input
1
2
3
10
 
Sample Output
1
2
5
16796
 
出栈问题。卡特兰数。
用java解决大数是多么的方便啊!!!
第一个java程序。
 
import java.util.*;
import java.math.BigInteger; public class Main { public static void main(String[] args) {
BigInteger[] a=new BigInteger[105];
a[0]=BigInteger.valueOf(1);
a[1]=BigInteger.valueOf(1);
for(int i=2;i<=100;i++)
a[i]=BigInteger.valueOf(0);
for(int i=2;i<=100;i++)
for(int j=1;j<=i;j++)
a[i]=a[i].add(a[j-1].multiply(a[i-j]));
//System.out.println(a[10]);
Scanner in =new Scanner(System.in);
int n;
while(in.hasNext())
{
n=in.nextInt();
System.out.println(a[n]);
}
} }
j

HDU_1023_Train Problem II_卡特兰数的更多相关文章

  1. hdu1032 Train Problem II (卡特兰数)

    题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能.    (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...

  2. HDU-1023 Train Problem II 卡特兰数(结合高精度乘除)

    题目链接:https://cn.vjudge.net/problem/HDU-1023 题意 卡特兰数的应用之一 求一个长度为n的序列通过栈后的结果序列有几种 思路 一开始不知道什么是卡特兰数,猜测是 ...

  3. C - Train Problem II——卡特兰数

    题目链接_HDU-1023 题目 As we all know the Train Problem I, the boss of the Ignatius Train Station want to ...

  4. HDU 1023 Train Problem II (卡特兰数,经典)

    题意: 给出一个数字n,假设火车从1~n的顺序分别进站,求有多少种出站序列. 思路: 卡特兰数的经典例子.n<101,用递推式解决.需要使用到大数.n=100时大概有200位以下. #inclu ...

  5. HDOJ 1023 Train Problem II 卡特兰数

    火车进站出站的问题满足卡特兰数...卡特兰数的相关知识如下: 卡特兰数又称卡塔兰数,是组合数学中一个常出现在各种计数问题中出现的数列.由以比利时的数学家欧仁·查理·卡塔兰 (1814–1894)命名. ...

  6. HDU 1023 Traning Problem (2) 高精度卡特兰数

    Train Problem II Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %I64d & %I64u Sub ...

  7. Train Problem II(卡特兰数+大数乘除)

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

  8. 1023 Train Problem II(卡特兰数)

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

  9. HDU 1023 Train Problem II (大数卡特兰数)

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

随机推荐

  1. spring-cloud-starter-ribbon提供客户端的软件负载均衡算法

    Ribbon是什么? Ribbon是Netflix发布的开源项目,主要功能是提供客户端的软件负载均衡算法,将Netflix的中间层服务连接在一起.Ribbon客户端组件提供一系列完善的配置项如连接超时 ...

  2. 桦仔------分享一下我研究SQLSERVER以来收集的笔记

    http://www.cnblogs.com/lyhabc/p/3219117.html

  3. VS2017-NetCore项目整合Log4Net

    1新建NetCore项目,我这里NetCoreSDK版本是2.2.0. 2.进入NuGet程序包官网 : https://www.nuget.org,搜索以下两个包并安装到项目中. Microsoft ...

  4. 【Storage】IBM DS8100开机及配置过程

     ************************************************************************ ****原文:blog.csdn.net/cla ...

  5. heap实现

    //STL提供的是Max heap,使用vector作为底部容器 //push_heap算法:首先将元素放到堆所对应的数组的末端,然后从该节点开始向上调整, //若当前结点键值比父结点大,则兑换位置, ...

  6. 我的Go语言学习之旅七:创建一个GUI窗口

    在上次中,刚刚学过了  弹窗效果.这里再接着学习一下怎样创建一个窗口. 还是老路子,先上代码: package main import ( "github.com/lxn/go-winapi ...

  7. ios ionic 装平台 笔记

    1.安装cnpm : npm install -g cnpm --registry=https://registry.npm.taobao.org 2.An error occurred when I ...

  8. .NET 的WebSocket开发包详细比较(2)

    AlchemyWebSocket http://alchemywebsockets.net/ 当我想到websocket库时,这个让人不可思议.没错这是真的.它可以排在Fleck后面,它非常容易使用, ...

  9. LuoguP3261 [JLOI2015]城池攻占

    题目描述 小铭铭最近获得了一副新的桌游,游戏中需要用 m 个骑士攻占 n 个城池.这 n 个城池用 1 到 n 的整数表示.除 1 号城池外,城池 i 会受到另一座城池 fi 的管辖,其中 fi &l ...

  10. Java I/O 的工作机制浅析

    I/O 问题可以说是当今互联网 Web 应用中所面临的主要问题之一,因为当前在这个海量数据时代,数据在网络中随处流动.这个流动的过程中都涉及到 I/O 问题,可以说大部分 Web 应用系统的瓶颈都是 ...