hdu-1131(卡特兰数+大数)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1131
思路:R(x)=h(x)*n!=C(n,2*n)*n!=A(n+2,n*2);
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn = ;
int i,j,n,a[maxn+];
int main(void)
{
while(~scanf("%d",&n)&&n)
{
memset(a,,sizeof(a));
a[]=;
for(i=n+;i<=*n;i++)
{
for(j=;j<;j++) a[j]*=i;
for(j=;j<;j++)
{
if(a[j]>=)
{
a[j+]+=a[j]/;
a[j]%=;
}
}
}
for(i=;i>&&a[i]==;i--) ;
for(;i>;i--) printf("%d",a[i]);
printf("%d\n",a[i]);
}
return ;
}
hdu-1131(卡特兰数+大数)的更多相关文章
- hdu 1130,hdu 1131(卡特兰数,大数)
How Many Trees? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- 2014年百度之星程序设计大赛 - 初赛(第一轮) hdu Grids (卡特兰数 大数除法取余 扩展gcd)
题目链接 分析:打表以后就能发现时卡特兰数, 但是有除法取余. f[i] = f[i-1]*(4*i - 2)/(i+1); 看了一下网上的题解,照着题解写了下面的代码,不过还是不明白,为什么用扩展g ...
- HDU 1134 卡特兰数 大数乘法除法
Problem Description This is a small but ancient game. You are supposed to write down the numbers 1, ...
- HDU 1134 Game of Connections(卡特兰数+大数模板)
题目代号:HDU 1134 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1134 Game of Connections Time Limit: 20 ...
- HDOJ/HDU 1133 Buy the Ticket(数论~卡特兰数~大数~)
Problem Description The "Harry Potter and the Goblet of Fire" will be on show in the next ...
- Buy the Ticket HDU 1133 卡特兰数应用+Java大数
Problem Description The "Harry Potter and the Goblet of Fire" will be on show in the next ...
- 【hdoj_1133】Buy the Ticket(卡特兰数+大数)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1133 题目的意思是,m个人只有50元钱,n个人只有100元整钱,票价50元/人.现在售票厅没钱,只有50元 ...
- Train Problem II(卡特兰数+大数乘除)
Train Problem II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDU 4828 (卡特兰数+逆)
HDU 4828 Grids 思路:能够转化为卡特兰数,先把前n个人标为0.后n个人标为1.然后去全排列,全排列的数列.假设每一个1的前面相应的0大于等于1,那么就是满足的序列,假设把0看成入栈,1看 ...
- hdu-1130(卡特兰数+大数乘法,除法模板)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1130 卡特兰数:https://blog.csdn.net/qq_33266889/article/d ...
随机推荐
- discuz 修改积分策略( 在周期中添加"每周" )
在 source/admincp/admincp_credits.php 文件中, ctrl+f 搜索 $lang['setting_credits_policy_cycletype_1'] 处, ...
- ssh结合tar命令把远程文件拉回来或推过去(实现数据无落地推送)
登录22后tar 压缩/var/log目录输出到标准输入通过管道传到本地22_log.tar.gz文件 ssh 192.168.0.22 "cd /var ;tar -zcvf - log& ...
- 提取linux中eth0的IP地址
法1:cut [root@oldboy oldboy]# ifconfig eth0|grep 'inet addr'|cut -d ":" -f2|cut -d " & ...
- 批量压缩文件.net
C#调用 ICSharpCode.SharpZipLib.Zip 实现解压缩功能公用类 最近想用个解压缩功能 从网上找了找 加自己修改,个人感觉还是比较好用的,直接上代码如下 using System ...
- Session的作用和使用场景
1.session何时被创建? 客户首次访问服务器时,回话session对象被创建并分配一个唯一的Id,同时id号发送到客户端,并存入cookie,使得客户端session对象和服务器端一致. 2.如 ...
- Django入门-简单的登录
1.登录页面 2.项目目录结构 3.需要修改四个文件 urls.py-------路径与函数之间的对应关系 views.py-------函数定义与逻辑处理 加入一个login.html文件 ...
- RN中关于组件中属性的传递
比如: 组件A想要给组件B中的组件C传递一个属性prop class A extends Component{ render(){ return( <B title = "这是一个标题 ...
- JPA子查询
Subquery<A> subquery = criteriaQuery.subquery(A.class); Root<A> root1 = subquery.from(A. ...
- Unity 5.1+ Assertion Library (断言库)
Unity 5.1+ ,加入了“断言库”,在 Asset 类中可以方便的找到需要使用断言的函数. UnityEngine.Assertions.Assert.IsNotNull( ) 为何使用断言 使 ...
- sqlserver 几种datatime的区别
参考文章1 smalldatetime 占4位精确到分钟.时间从1900.1.1到2079.6.6datetime占8位精确到毫秒.时间从1753.1.1到9999.12.31 参考文章2 datet ...