Time Limit: 1000MS   Memory Limit: 30000K
Total Submissions: 7888   Accepted: 3965

Description

This is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, . . . , 2n - 1, 2n consecutively in clockwise order on the ground to form a circle, and then, to draw some straight line segments to connect them into number pairs. Every number must be connected to exactly one another. 
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

Each line of the input file will be a single positive number n, except the last line, which is a number -1. 
You may assume that 1 <= n <= 100.

Output

For each n, print in a single line the number of ways to connect the 2n numbers into pairs.

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的更多相关文章

  1. POJ2084 Game of Connections 卡特兰数 关于卡特兰数经典的几个问题

    Game of Connections Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 9128   Accepted: 44 ...

  2. 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, ...

  3. nyoj 164&amp;&amp;poj2084 Game of Connections 【卡特兰】

    题意:将1~2n个数依照顺时针排列好.用一条线将两个数字连接起来要求:线之间不能有交点.同一个点仅仅同意被连一次. 最后问给出一个n,有多少种方式满足条件. 分析: ans[n]表示n的中的种类数. ...

  4. (Catalan数 大数) Game of Connections poj2084

    Language: Game of Connections Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 8837 Accept ...

  5. 解决mysql too many connections的问题

    由于公司服务器上的创建的项目太多,随之创建的数据库不断地增加,在用navicat链接某一个项目的数据库时会出现too many connections ,从而导致项目连接数据库异常,致使启动失败. 为 ...

  6. Data source rejected establishment of connection, message from server: "Too many connections"解决办法

    异常名称 //数据源拒绝从服务器建立连接.消息:"连接太多" com.MySQL.jdbc.exceptions.jdbc4.MySQLNonTransientConnection ...

  7. Configure Security Settings for Remote Desktop(RDP) Services Connections

    catalogue . Configure Server Authentication and Encryption Levels . Configure Network Level Authenti ...

  8. 问题解决: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 ...

  9. Too Many Connections: How to Increase the MySQL Connection Count To Avoid This Problem

    1.问题描述 在启动使用mysql数据库的项目时,遇到一个报错,如下: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConn ...

随机推荐

  1. CSS浮动特性总结

    1.假设现在CSS中没有浮动(float)属性,那么会变成一个什么样子.我们会发现,目前流行采用浮动方法实现的无论是分栏布局,还是列表排列我们都可以用其他一些CSS属性(不考虑table)代替实现,唯 ...

  2. HTML5 基础

    1.HTML5 简介 HTML5 是最新的 HTML 标准,他是万维网的核心语言.标准通用标记语言下的一个应用“超文本标记语言”. HTML 的上一个标准 HTML4.01 诞生于 1999年,他的第 ...

  3. POJ1182并查集

    食物链 时间限制:1000 ms  |  内存限制:65535 KB 难度:5   描述 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形.A吃B, B吃C,C吃A. 现有N个动物, ...

  4. JavaScript中的运算符种类及其规则介绍

    JavaScript中的运算符有很多,主要分为算术运算符,等同全同运算符,比较运算符,字符串运算符,逻辑运算符,赋值运算符等.这些运算符都有一些属于自己的运算规则,下面就为大家介绍一下JavaScri ...

  5. Web程序发布后显示个性化图标

    采用Tomcat发布程序后,浏览器上默认显示程序的图标是Tomcat图标.如下图所示: 需要显示自己个性化的图标,比如,这里显示一个图标. 只需要如下三步设置即可. 将制作的ico图标放在程序的根目录 ...

  6. poj 1113 Mall

    Mall 水题:注意题目上面有一个至少离城堡的距离为L,其实思考一下就知道是指离凸包(凸多边形)的距离为L,这时很容易知道外围的圆的圆心角叠加之后就是一个整圆:和poj2187一样使用graham形成 ...

  7. pair work-Elevator Schedule

    编程人员:周敏轩 192 周萱 149 1 有关结对编程的思考 结对编程技术是指两位程序员肩并肩地坐在同一台电脑前合作完成同一个设计.同一个算法.同一段代码或同一组测试.通过这次的结对编程练习我结识了 ...

  8. WCF 消息压缩性能问题及解决方法

    最近使用WCF作为通迅框架开发一套信息系统,系统使用传统C/S框架,系统有可能会部署在互联网上,因此决定对传输的数据进行GZIP压缩,原来在使用.NET Remoting时,可以使用插入自定义的Cha ...

  9. Firefly 配置说明

    下图一一个典型的config.json的配置:配置中主要包括四个部分,master,servers,db,memcached.master用来定义master的端口,servers用来定义各个服务器中 ...

  10. 数据库里面DataTime时间类型字段,如果为null时

    tran.TransactionTime = bet.CreationDate.ToString() == "0001/1/1 0:00:00" ? DateTime.Now : ...