题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1130

卡特兰数:https://blog.csdn.net/qq_33266889/article/details/53409553

参考文章:https://blog.csdn.net/sunshine_YG/article/details/47685737

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int base = ;
const int maxn = ;
int a[maxn+][maxn+],n,i,j;
void Init()
{
int tmp;
a[][]=;a[][]=;a[][]=;
for(i=;i<=;i++)
{
for(j=;j<;j++)
{
a[i][j]+=a[i-][j]*(*i-);
a[i][j+]+=a[i][j]/base;
a[i][j]%=base;
}
for(j=;j>=;j--)
{
tmp=a[i][j]%(i+);
a[i][j-]+=tmp*base;
a[i][j]/=(i+);
}
}
}
int main(void)
{
Init();
while(~scanf("%d",&n))
{
i=;
while(a[n][i]==) i--;
printf("%d",a[n][i--]);
while(i>) printf("%04d",a[n][i--]);
printf("\n");
}
return ;
}

hdu-1130(卡特兰数+大数乘法,除法模板)的更多相关文章

  1. HDU 1134 卡特兰数 大数乘法除法

    Problem Description This is a small but ancient game. You are supposed to write down the numbers 1, ...

  2. 2014年百度之星程序设计大赛 - 初赛(第一轮) hdu Grids (卡特兰数 大数除法取余 扩展gcd)

    题目链接 分析:打表以后就能发现时卡特兰数, 但是有除法取余. f[i] = f[i-1]*(4*i - 2)/(i+1); 看了一下网上的题解,照着题解写了下面的代码,不过还是不明白,为什么用扩展g ...

  3. hdu 1130,hdu 1131(卡特兰数,大数)

    How Many Trees? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  4. HDU 1134 Game of Connections(卡特兰数+大数模板)

    题目代号:HDU 1134 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1134 Game of Connections Time Limit: 20 ...

  5. (母函数 Catalan数 大数乘法 大数除法) Train Problem II hdu1023

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

  6. HDOJ/HDU 1133 Buy the Ticket(数论~卡特兰数~大数~)

    Problem Description The "Harry Potter and the Goblet of Fire" will be on show in the next ...

  7. Buy the Ticket HDU 1133 卡特兰数应用+Java大数

    Problem Description The "Harry Potter and the Goblet of Fire" will be on show in the next ...

  8. 【hdoj_1133】Buy the Ticket(卡特兰数+大数)

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=1133 题目的意思是,m个人只有50元钱,n个人只有100元整钱,票价50元/人.现在售票厅没钱,只有50元 ...

  9. HDU-4828 卡特兰数+带模除法

    题意:给定2行n列的长方形,然后把1—2*n的数字填进方格内,保证每一行,每一列都是递增序列,求有几种放置方法,对1000000007取余: 思路:本来想用组合数找规律,但是找不出来,搜题解是卡特兰数 ...

随机推荐

  1. libcurl 支持openssl 但不能访问https

    重新编译了libcurl 去访问https 地址还是不能访问 从网上找到了解决方案: curl有两种方式使用https : 1. 设定为不验证证书和HOST code = curl_easy_seto ...

  2. Erlang/OTP:基于Behaviour的回调函数

    原始链接:https://blog.zhustec.me/posts/erlang-otp-1-callback-based-on-behaviour OTP 是什么 OTP 的全称是开源电信平台 ( ...

  3. jenkins 没有maven选项,怎么办

    第一步: 进入jenkins,点系统管理 第二:插件管理 点击“可选插件”  然后在右边的过滤输入框中输入搜索关键字: Maven Integration  或者 Pipeline Maven Int ...

  4. TCP/IP知识总结(TCP/IP协议族读书笔记二)

    接下来,总结一下网络层的协议,IP,ARP,RARP,ICMP,IGMP.当我们在网络传输的过程中,把分组交付到主机或路由器需要两级地址:物理地址和逻辑地址.而且我们需要能够把物理地址映射成为相应的逻 ...

  5. C++17尝鲜:在 if 和 switch 语句中进行初始化

    初始化语句 在C++17中,类似于 for 语句,在 if 和 switch 语句的判断条件之前也能加上初始化语句,语法形式如下: if (初始化语句; 条件) 语句 else 语句 switch ( ...

  6. Recursion递归

    /*java.lang 核心包 如 String Math Integer System Thread等 拿来直接用 * java.awt 窗口工具 GUI * java.net 网络包 * java ...

  7. 向数据库添加学生信息。存放在REQUEST对象里

    代码前几天已经发过了,但是程序一直还没运行出来,今天重新建立了一个数据库,才可以,下面补充上数据截图

  8. GBDT 将子树结果当成lr输出

    http://scikit-learn.org/stable/auto_examples/ensemble/plot_feature_transformation.html#example-ensem ...

  9. IE低版本浏览器兼容问题

    head标签中填写如下代码 <meta name="renderer" content="webkit"/> <meta name=" ...

  10. Hibernate分页查询的两个方法

    Hibernate中HQL查询语句有一个分页查询, session.setMaxResult(参数)和session.setFirstResult(参数) 如果只设置session.setMaxRes ...