# SGU130-circle

9372人阅读 评论(0)

### 130. Circle

time limit per test: 0.5 sec.
memory limit per test: 4096 KB

On a circle border there are 2k different points A1, A2, ..., A2k, located contiguously. These points connect k chords so that each of points A1, A2, ..., A2k is the end point of one chord. Chords divide the circle into parts. You have to find N - the number of different ways to connect the points so that the circle is broken into minimal possible amount of parts P.

Input

The first line contains the integer k (1 <= k <= 30).

Output

The first line should contain two numbers N and P delimited by space.

Sample Input

2


Sample Output

2 3


#include<iostream>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include<vector>
#include<map>
#include<deque>
#include<list>
using namespace std;
int main()
{
int i,j,n;
long long D[31];
D[0]=1;
D[1]=1;
D[2]=2;
//画一条弦，则圆被分成两部分，两部分可以各自看成点数比较少的圆，
//用两部分分割方法数相乘。以一点为这条弦的一端，枚举另一端求和。
for(i=3; i<=30; i++)
{
D[i]=0;
for(j=1; j<=i; j++)
D[i]+=D[j-1]*D[i-j];
}
while(cin>>n)
{
cout<<D[n]<<" "<<n+1<<endl;
}
return 0;
}


0
0

* 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场
个人资料
• 访问：395461次
• 积分：6419
• 等级：
• 排名：第3756名
• 原创：240篇
• 转载：7篇
• 译文：0篇
• 评论：45条
文章分类