卡特兰数(Train Problem II HDU - 1023 )

linux下wayland协议修改键盘映射 linux下wayland协议,修改键盘映射,实验环境是Ubuntu24,其他wayland协议窗口应该也是可以的。 阅读详情

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. 
InputThe 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. 
OutputFor 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


        
  
Hint
The result will be very large, so you may not process it by 32-bit integers.


第几个卡提兰数

代码:

#include<stdio.h>
int a[110][100];   //a[n][] 前一个括号是第几个卡特兰数, 后一个括号是表示的卡特兰数的每一位数; 
int b[110];        // b[n] 第n个卡特兰数的长度;
//卡特兰数的 递推式为 h[n]=h[0]*h[n-1]+h[1]*h[n-2]+.....+h[n-1]*h[0];
//    另类递推式 h[n]=h[n-1]*(4*n-2)/(n+1);  
void ktl()        // 因最大的卡特兰数是58位,longlong也存不下,所以要分解; 
{
	int i,j,k,t,len;
	a[1][0]=b[1]=1;
	len=1;
	for(i=2;i<=100;i++)
	{
		for(j=0;j<len;j++)  //  乘法,n-1个的卡特兰数的每一位乘以(4*n-2) 
			a[i][j]=a[i-1][j]*(4*(i-1)+2);
		k=0;
		for(j=0;j<len;j++)		//得第n个卡特兰数的每一位; 
		{
			a[i][j]=k+a[i][j];
			t=a[i][j];
			a[i][j]=t%10;
			k=t/10;
		}
		while(k)
		{
			a[i][len++]=k%10;   // 进位处理 
			k=k/10;
		}
		k=0;
		for(j=len-1;j>=0;j--)  //模拟除法 
		{   
			t=(k*10+a[i][j]);
			a[i][j]=t/(i+1);
			k=t%(i+1);
		}
		while(a[i][len-1]==0) // 高位零处理 
			len--;
		b[i]=len;
	}
}
int main()
{
	int i,j,k,t,n;
	ktl();
	while(~scanf("%d",&n))
	{
		for(i=b[n]-1;i>=0;i--)
			printf("%d",a[n][i]);
		printf("\n");
	}
	return 0;
}

lammps蒙特卡洛MC模拟案例 在lammps中,和MC相关的模拟命令有三个:fix gcmc、fix atom/swap、fix sgcmc。在一个lammps模拟中,mc和md可同时存在,间隔运行,所以设置fix sgcmc命令的同时,可以同时设置系综(nve、nvt或者npt)。lammps官网自带案例中也有一个fix sgcmc的案例,主要模拟FeCu合金的MC建模。sgcmc命令可应用到合金的模拟中,如短程有序模拟。MC运行间隔为100步,最终的浓度比例为0.02,也就是2%的Fe原子交换为Cu原子。大家好,我是小马老师。 阅读详情

相关推荐

现控报告-- 分析倒立摆系统稳定性、能控性及能观性分析,设计PID控制方案(附matlab)

建立直线一级倒立摆系统的动力学模型,推导该系统的运动方程,求出直线一级倒立摆系统传递函数模型及空间状态方程模型。接着描述了PID控制系统设计原理及PID控制器各校正环节的作用,简要叙述了参数的整定方法。设计了直线一级倒立摆摆杆摆角及小车位置常规单回路控制器,通过Simulink仿真知道常规单回路控制器能控制摆杆摆角,不能控制小车位置。于是设计出了直线一级倒立摆双闭环控制器及基于倒立摆系统的状态空间方程控制器,利用软件进行仿真,仿真结果表明,常规双闭环控制方案和基于状态空间方程加控制方案均能对摆杆摆角及小车位

mengshenglo的博客 4万+

Train Problem II(卡特兰数以及高精度运算)

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

sdau20163940的博客 1433

PointPainting 复现

三维目标检测

weixin_58207716的博客 4548

杭电1023——Train Problem II

Train Problem II 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 ...

编程语言小筑 344

Photoshop实战技巧(9)——高效去除复杂水印的五种进阶方法

本文详细介绍了Photoshop中高效去除复杂水印的五种进阶方法,包括色阶通道爆破法、频率分离高阶应用、智能填充+手动修复组合拳等专业技巧。针对半透明水印、密集文字水印等复杂场景,提供分步操作指南和实战案例,帮助用户精准去除水印同时保留原始图像细节,大幅提升工作效率。

cake8的博客 971

PostgreSQL 超详细安装与使用教程:从入门到实战

本文将详细介绍PostgreSQL数据库的安装配置与基础使用。首先从Windows系统安装入手,分步骤讲解17.5版本的安装流程、环境变量配置及服务启动验证。接着重点介绍了pgAdmin4图形化管理工具的安装与使用,包括界面语言设置、数据库连接、创建与管理数据库等操作,同时对比了可视化操作与SQL命令两种方式。最后梳理了PgSQL基础语法,涵盖表的创建、增删改查操作、约束管理等内容,为初学者提供了完整的PostgreSQL入门指南。文章兼顾理论知识与实际操作,既适合数据库新手学习,也可作为开发人员的快速参考

gtf212的博客 1万+

HDU1023_Train Problem II_卡特兰数

Train Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9019    Accepted Submission(s): 4829 Problem Description As we all

弱的奋斗之旅 344

LM358实战:手把手教你搭建电流检测电路(附电阻选型计算)

本文详细解析了使用LM358运算放大器搭建电流检测电路的全过程,包括基础原理、采样电阻选型、放大电路设计及PCB布局技巧。通过实战案例和精确计算,帮助工程师快速掌握低成本、高精度的电流检测方案,适用于电源管理、电机控制等多种应用场景。

weixin_30872157的博客 470

Train Problem II hdu1023

Problem DescriptionAs 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 ge...

恒持此志成永志 229

sentaurus学习笔记(HFET_pGate_GaN仿真)(九)

`(sdedr:define-constant-profile-placement "Ohmic.s" "Ohmic" "Pl.ohmic.s" 0.002)`这一行将`"Ohmic"`掺杂剖面放置在`"Pl.ohmic.s"`参考评估窗口中,同样`0.002`可能表示掺杂剖面在窗口中的偏移量或其他参数。欧姆接触是半导体器件中的一种低阻抗电气接触,通常需要高掺杂来减少接触电阻并提高器件性能。通过这些步骤,SDE能够为器件的源极和漏极区域设置高掺杂的欧姆接触,这对于确保器件的高性能和低接触电阻至关重要。

qq_52640792的博客 1395

基于树莓派4B与NCNN的YOLOv8高效部署实战:无GPU环境下的C++加速优化全流程指南**

本文详细介绍了在树莓派4B上基于NCNN框架部署YOLOv8目标检测模型的全流程。内容包括:从PyTorch模型导出NCNN格式文件、树莓派环境配置(OpenCV和NCNN编译)、C++实现代码解析(含模型加载、推理及后处理),以及实际部署测试结果。在树莓派4B上达到约2FPS,并提供INT8量化、多线程等优化建议。该方案为无GPU设备提供了轻量化目标检测的实用部署方案,适合边缘计算场景。

FJN110的博客 926

【HDU-1023】 Train Problem II 【卡特兰数+高精度】

传送门:http://acm.split.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): 8612    A

魔笛手的博客 588

2021年高职组DCN信息安全管理与评估赛题-国赛真题解析答案

2021年高职组DCN信息安全管理与评估赛题-国赛真题解析答案 购买专栏解锁更多资源 DCRS工作任务 DCRS 开启 telnet 登录功能,用户名 dcn01,密码 dcn01,配置使 用 telnet 方式登录终端界面前显示如下授权信息: “WARNING!!! Authorised access only, all of your done will be recorded! Disconnected IMMEDIATELY if you are not an authorised user! O

Jay 1024

HDU 1023 Train Problem II Catalan数(卡特兰数)

HDU 1023 Train Problem II Train Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7876    Accepted Submission(s): 4223 Probl

huatian5的博客 583

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

ACM-卡特兰数之Train Problem II——hdu1023

ACM 卡特兰数 Train Problem II hdu1023 大数乘法(存五位数)

继续激情,继续奋斗。 3122

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

HDU 1023 Train Problem II (打表求解卡特兰数)

HDU 1023 Train Problem Ⅱ:http://acm.hdu.edu.cn/showproblem.php?pid=1023 题面: Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7629    Accepted

而濡木染 656

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

【hdu1023】Train Problem II(卡特兰数模版题)

Train Problem II Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 12896Accepted Submission(s): 6868 Problem Description As we all kno...

欢迎访问方偲的博客 270

hdu 1023Train Problem II 卡特兰数

卡特兰数的应用。。。提交后presentation error.........看了下题目没有什么特殊格式要处理的啊,后来把puts(" ");换成printf("\n");就过了。 我就纳闷了,原来我puts(""),引号里面多了一个空格。。。。。。以后一定要小心。 模版如下: 卡特兰数公式如下: 原理 令h(1)=1,h(0)=1,catalan数满足递归式: h(n)= h(...

weixin_30919571的博客 139

hdu 1023 Train Problem II 【卡特兰数+大数】

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1023; 卡特兰数公式: 令h(0)=1,h(1)=1,Catalan数满足递推式:h(n)= h(0)*h(n-1)+h(1)*h(n-2) + ... + h(n-1)*h(0) (n&gt;=2) 例如: h(2)=h(0)*h(1)+h(1)*h(0)=1*1+1*1=2 h(3)=h(0...

几许情愁的博客 222

HDU1023 Train Problem II(卡特兰数+大数)

HDU1023 Train Problem II(卡特兰数+大数) HDU1023 Train Problem II(卡特兰数+大数) 题意 思路 AC代码 原题地址:http://acm.hdu.edu.cn/showproblem.php?pid=1023 题意 此题是Train Problem I 的一个衍生,有一个站台(可以看做是栈,先进后出),给你一个数代表火车...

HuiSeKongHuan的博客 532

hdu1023 Train Problem II(卡特兰数)

#include #include int a[105][105]; //大数卡特兰数 int b[105]; //卡特兰数的长度 void catelan() { int len,temp,c,i,j; a[1][0]=b[1]=1; len=1; for(i=2; i<=100; i++) { for(

W_904038290的博客 319

HDU 1023 Train Problem II(卡特兰数)

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 ca

Misdom_Tian_Ya的专栏 517

hdu 1023 Train Problem II (卡特兰数)

卡特兰数又称卡塔兰数,英文名Catalan number,是组合数学中一个常出现在各种计数问题中出现的数列 令h(0)=1,h(1)=1, catalan数满足递推式:h(n)= h(0)*h(n-1)+h(1)*h(n-2) + ... + h(n-1)h(0) (n>=2) 例如:h(2)=h(0)*h(1)+h(1)*h(0)=1*1+1*1=2         h(3)=h(0)

不知 442

HDU-1023 Train Problem II(卡特兰数)

Train Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6797    Accepted Submission(s): 3683 Problem Description As we all

逝水流年轻染尘 389

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

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 ...

weixin_33800593的博客 106

HDU 1023 Train Problem II (卡特兰数)

Train Problem IITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8450 Accepted Submission(s): 4525Problem Description As we all know the Tra

MrBlank的ACM记事本 273
上一篇: Wand FZU - 2282 (组合数 + 错排公式)
下一篇: 一维战舰 51Nod - 1521 (set 二分查找,判断撒谎)
obsorb_knowledge
博客等级 码龄9年 38粉丝 213原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址