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 ...
随机推荐
- AS3 歌词同步
这里实例素材: 我们不一样.lrc 我们不一样.mp3 歌词同步其实就是靠lrc文本文件,打开它,可以看到时间点和对应的歌词. 打开lrc内容如下: [ti:我们不一样][ar:大壮][al:][by ...
- vue深入了解组件——动态组件&异步组件
一.在动态组件上使用 keep-alive 我们之前曾经在一个多标签的界面中使用 is 特性来切换不同的组件: <component v-bind:is="currentTabComp ...
- Eclipse 安装JavaEE插件
Oxygen版Eclipse 导入项目会自动安装你项目需要的一些插件,但是有时候会安装失败,需要手动安装: 这里以Dynamic Web Project项目为例 打开Eclipse,依次选择Help ...
- JSP复习(part 2 )
3.4.2 访问(获取)请求参数 1.方法 String 字符串变量 =request.getParameter("客户端提供参数的name属性名"): 2.传参数的三种形式 (1 ...
- Python 列表表达式 ,迭代器(1)
python 环境 3.5 1.列表: s = []; for i in s: i = handleFunction(i); s.append(i) .列表 s=[handleFunction(i) ...
- Ubuntu 18.04上安装R及Rstudio
安装R引用自:https://www.howtoing.com/how-to-install-r-on-ubuntu-18-04 安装Rstudio引用自:https://www.rstudio.co ...
- 使用python发送邮件
最近需要做一个功能,统计bug的数量,然后发邮件给指定人,所有就先要了解一下使用python发送邮件 代码如下: #coding: utf-8 import smtplib from email.MI ...
- golang interface接口
package main import "fmt" type Shaper interface { Area() float32 } type Square struct { si ...
- numpy.unpackbits()
numpy.unpackbits numpy.unpackbits(myarray, axis=None) Unpacks elements of a uint8 array into a binar ...
- visual code golang配置
前言 其实环境搭建没什么难的,但是遇到一些问题,主要是有些网站资源访问不了(如:golang.org), 导致一些包无法安装,最终会导致环境搭建失败,跟据这个教程几步,我们将可以快速的构建golang ...