Time Limit:500MS Memory Limit:4096KB 64bit IO Format:%I64d & %I64u
Description
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<sstream> #include<fstream> #include<vector> #include<list> #include<deque> #include<queue> #include<stack> #include<map> #include<set> #include<bitset> #include<algorithm> #include<cstdio> #include<cstdlib> #include<cstring> #include<cctype> #include<cmath> #include<ctime> using namespace std; long long f(int n) { if(n==0) return 1; else { long long a=0; return a; } } int main() { int k; long long a[34]; memset(a,0,sizeof(a)); a[0]=1; a[1]=1; a[2]=2; for(int i=3;i<33;i++) { for(int j=0;j<=i-1;j++) { a[i]+=a[j]*a[i-1-j]; } } cin>>k; cout<<a[k]<<" "<<k+1; }