[POJ2084]Game of Connections
| Time Limit: 1000MS | Memory Limit: 30000K | |
| Total Submissions: 7888 | Accepted: 3965 |
Description
And, no two segments are allowed to intersect.
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?
Input
You may assume that 1 <= n <= 100.
Output
Sample Input
2
3
-1
Sample Output
2
5
Source
Thinking
高精度卡特兰数,如果不想写高精度就像我一样打表吧。记得用超长字符串。
PS:卡特兰数第一百项需用恒河沙记(10^57),你考虑考虑什么能存的下。
const a:array[..] of ansistring =
('',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
''
);
var n:longint;
begin
while true do
begin
read(n);
if n=- then halt;
writeln(a[n]);
end;
end.
[POJ2084]Game of Connections的更多相关文章
- POJ2084 Game of Connections 卡特兰数 关于卡特兰数经典的几个问题
Game of Connections Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 9128 Accepted: 44 ...
- POJ2084 Game of Connections(数学,dp)
题目链接. 分析: 简单的 Catalan 数 将x~y编号,设解为 d(x, y), d(x, y) = {d(x+1,i-1)*d(i+1,y)}, 其中 x+1<= i <= y, ...
- nyoj 164&&poj2084 Game of Connections 【卡特兰】
题意:将1~2n个数依照顺时针排列好.用一条线将两个数字连接起来要求:线之间不能有交点.同一个点仅仅同意被连一次. 最后问给出一个n,有多少种方式满足条件. 分析: ans[n]表示n的中的种类数. ...
- (Catalan数 大数) Game of Connections poj2084
Language: Game of Connections Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 8837 Accept ...
- 解决mysql too many connections的问题
由于公司服务器上的创建的项目太多,随之创建的数据库不断地增加,在用navicat链接某一个项目的数据库时会出现too many connections ,从而导致项目连接数据库异常,致使启动失败. 为 ...
- Data source rejected establishment of connection, message from server: "Too many connections"解决办法
异常名称 //数据源拒绝从服务器建立连接.消息:"连接太多" com.MySQL.jdbc.exceptions.jdbc4.MySQLNonTransientConnection ...
- Configure Security Settings for Remote Desktop(RDP) Services Connections
catalogue . Configure Server Authentication and Encryption Levels . Configure Network Level Authenti ...
- 问题解决:psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
错误提示: psql: could not connect to server: No such file or directory Is the server running locally and ...
- Too Many Connections: How to Increase the MySQL Connection Count To Avoid This Problem
1.问题描述 在启动使用mysql数据库的项目时,遇到一个报错,如下: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConn ...
随机推荐
- html5绘制折线图
html5绘制折线图详细代码 <html> <canvas id="a_canvas" width="1000" height="7 ...
- PHP之session_start()详解
1.session的工作原理 (1)首先使用session_start()函数进行初始换 (2)当执行PHP脚本时,通过使用$_SESSION超全局变量注册session变量. (3)当PHP脚本执行 ...
- iframe 适用高度
contentWindow 兼容各个浏览器,可取得子窗口的 window 对象. contentDocument Firefox 支持,> ie8 的ie支持.可取得子窗口的 document ...
- hdu 4746 Mophues 莫比乌斯反演+前缀和优化
Mophues 题意:给出n, m, p,求有多少对a, b满足gcd(a, b)的素因子个数<=p,(其中1<=a<=n, 1<=b<=m) 有Q组数据:(n, m, ...
- 蜗牛历险记(二) Web框架(下)
Web框架第三篇--缓存篇 缓存的优劣很大程度上决定了框架的效率,一个有节操的缓存它应该是高效的,利用率高的,具备更多扩展功能的. 一.介绍之前 计算机各个硬件的运行效率是不一样的,CPU>&g ...
- C# - 自动属性
使用自动属性时,只能通过属性访问数据,不能通过底层私有字段,因为我们不知道底层私有字段的名称,是编译期间定义的.所以也没法对字段赋值或取值进行校验或限制. 无法使用这种方式定义只读或只写属性.
- C#操作mongodb数据库
1.下载驱动: 如下图:选择c#解决方案,右键,点击 “管理NuGet程序包(N)...” 在弹出的对话框中,输入MongoDB.Driver,进行搜索,然后选择安装. 2.引用命名空间: using ...
- HTML5给我们带来了什么?
HTML5初探 传说中的HTML标准已经超过10年没有更新了,如今HTML5席卷全球,那么到底什么是HTML5呢?都在讲HTML5是web的新一代标准,它有着很多之前浏览器没有的新特性,可以说HTML ...
- cs ip 通过jmp转移命令间接赋值。无法直接对其赋值。
jmp 寄存器 命令 对IP间接赋值.
- PieTTY
PieTTY 用 pietty 連上主機時 鍵盤右方數字鍵 (keypad) 失效的問題 用 pietty 連上主機時 鍵盤右方數字鍵 (keypad) 失效的問題 應該滿多人用 pietty 連上程 ...