HDU——1134 Game of Connections
Game of Connections
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4844 Accepted Submission(s): 2811
It's still a simple game, isn't it? But after you've written down the 2n numbers, can you tell me in how many different ways can you connect the numbers into pairs? Life is harder, right?
3
-1
5
#include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> #define N 110 using namespace std; int n,len,tmp,sum,b[N],a[N][N]; int read() { ,f=; char ch=getchar(); ; ch=getchar();} +ch-'; ch=getchar();} return x*f; } int catelan() { len=; a[][]=b[]=; ;i<;i++) { ;j<len;j++) a[i][j]=a[i-][j]*(i*-); sum=; ;j<len;j++) { tmp=sum+a[i][j]; a[i][j]=tmp%; sum=tmp/; } while(sum) { a[i][len++]=sum%; sum/=; } ;j>=;j--) { tmp=sum*+a[i][j]; a[i][j]=tmp/(i+); sum=tmp%(i+); } ]) --len; b[i]=len; } } int main() { catelan(); ) { n=read(); ) break; ;i>=;i--) printf("%d",a[n][i]); printf("\n"); } ; }
HDU——1134 Game of Connections的更多相关文章
- HDU 1134 Game of Connections(卡特兰数+大数模板)
题目代号:HDU 1134 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1134 Game of Connections Time Limit: 20 ...
- hdu 1134 Game of Connections
主要考察卡特兰数,大数乘法,除法…… 链接http://acm.hdu.edu.cn/showproblem.php?pid=1134 #include<iostream>#include ...
- HDU - 1134 Game of Connections 【DP】
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1134 题意 给出一个n 然后有2n个点 给两个点连一条边,最后连N条边,要求所有的边不能够交叉 问最多 ...
- HDU ACM 1134 Game of Connections / 1130 How Many Trees?(卡特兰数)
[题目链接]http://acm.hdu.edu.cn/showproblem.php?pid=1134 [解题背景]这题不会做,自己推公式推了一段时间,将n=3和n=4的情况列出来了,只发现第n项与 ...
- 【HDOJ】1134 Game of Connections
Catlan数. /* 1134 */ import java.util.Scanner; import java.math.BigInteger; /* Catalan: (1) h(n) = h( ...
- HDU 1134 卡特兰数 大数乘法除法
Problem Description This is a small but ancient game. You are supposed to write down the numbers 1, ...
- ACM第一阶段学习内容
一.知识目录 字符串处理 ................................................................. 3 1.KMP 算法 .......... ...
- hdu 2874 Connections between cities [LCA] (lca->rmq)
Connections between cities Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (J ...
- HDU 2874 Connections between cities (LCA)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2874 题意是给你n个点,m条边(无向),q个询问.接下来m行,每行两个点一个边权,而且这个图不能有环路 ...
随机推荐
- 题解报告:hdu 1035 Robot Motion(简单搜索一遍)
Problem Description A robot has been programmed to follow the instructions in its path. Instructions ...
- ACM_Plants vs. Zombies(一元一次方程)
Plants vs. Zombies Time Limit: 2000/1000ms (Java/Others) Problem Description: There is a zombie on y ...
- Storm概念学习系列之storm流程图
把stream当做一列火车, tuple当做车厢,spout当做始发站,bolt当做是中间站点!!! 见 Storm概念学习系列之Spout数据源 Storm概念学习系列之Topology拓扑 Sto ...
- jquery.autocomplete.js用法及示例,小白进
8 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 ...
- overflow实现隐藏滚动条同时又可以滚动
.scroll-list ul{ white-space: nowrap; -webkit-overflow-scrolling: touch; overflow-x: auto; overflow- ...
- Python批量生成用户名
写在最前 平时在工作中尤其是在做压测的时候难免需要一些用户名和密码,写个简单的Python小脚本批量生成一些 代码示例 import random,string #生成大小字母和数字一起的大字符串 a ...
- 微信小程序组件解读和分析:三、swiper滑块视图
swiper滑块组件说明: 滑块视图容器,用于展示图片,可以通过用户拖拽和设置自动切换属性控制图片的切换 组件的使用示例的运行效果如下: 下面是WXML代码: [XML] 纯文本查看 复制代码 ? ...
- Angular——单页面实例
基本介绍 1.引入的route模块可以对路由的变化做出响应 2.创建的控制器中依然需要$http向后台请求数据 3.php中二维数据的遍历用的是foreach 4.php中$arr=array(),$ ...
- MyBatis 之一 简介
什么是 MyBatis ? MyBatis 是支持定制化 SQL.存储过程以及高级映射的优秀的持久层框架.MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集.MyBatis ...
- 并发编程学习笔记(12)----Fork/Join框架
1. Fork/Join 的概念 Fork指的是将系统进程分成多个执行分支(线程),Join即是等待,当fork()方法创建了多个线程之后,需要等待这些分支执行完毕之后,才能得到最终的结果,因此joi ...