题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能.    (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前几项为 : 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845, 35357670- 令h(0)=1,h(1)=1,catalan数满足递推式:      h(n)= h(0…
题目链接_HDU-1023 题目 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 sever…
题意: 给出一个数字n,假设火车从1~n的顺序分别进站,求有多少种出站序列. 思路: 卡特兰数的经典例子.n<101,用递推式解决.需要使用到大数.n=100时大概有200位以下. #include <bits/stdc++.h> using namespace std; ; vector<string> vect; void _mult(string num1, string num2, string &result ) { reverse(num1.begin()…
题目链接:https://cn.vjudge.net/problem/HDU-1023 题意 卡特兰数的应用之一 求一个长度为n的序列通过栈后的结果序列有几种 思路 一开始不知道什么是卡特兰数,猜测是一个递推题 注意到在序列第i个元素入栈时,前几个元素都进过栈,就是通过栈的操作 设n个元素通过栈的结果序列个数为h[n],则有: \[ h_n=h_1h_{n-1}+h_2h_{n-2}+...+h_{n-1}h_1 \] 查了以后发现这是卡特兰数的规律,有通项: \[ h_n=h_{n-1}\fr…
火车进站出站的问题满足卡特兰数...卡特兰数的相关知识如下: 卡特兰数又称卡塔兰数,是组合数学中一个常出现在各种计数问题中出现的数列.由以比利时的数学家欧仁·查理·卡塔兰 (1814–1894)命名. 前几项为 (OEIS中的数列A000108): 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845, 35357670, 129644790, 477638700, 176…
Train Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7539    Accepted Submission(s): 4062 Problem Description As we all know the Train Problem I, the boss of the Ignatius Train Stat…
Train Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4358    Accepted Submission(s): 2391 Problem Description As we all know the Train Problem I, the boss of the Ignatius Train Stati…
Train Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10372    Accepted Submission(s): 5543 Problem Description As we all know the Train Problem I, the boss of the Ignatius Train Sta…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1023 Train Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12035    Accepted Submission(s): 6422 Problem Description As we all know the…
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 Stati…