标签:sim limit getch 最短路径 show lan ssi 礼物 pre
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 11004 Accepted Submission(s): 5569
#include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<algorithm> #define N 100 using namespace std; int n,tot; long long h[N]; int read() { int x=0,f=1; char ch=getchar(); while(ch<‘0‘||ch>‘9‘){if(ch==‘-‘)f=-1; ch=getchar();} while(ch>=‘0‘&&ch<=‘9‘){x=x*10+ch-‘0‘; ch=getchar();} return x*f; } int catelan() { h[0]=1,h[1]=1; for(int i=2;i<=40;i++) for(int j=1;j<=i;j++) h[i]=h[j-1]*h[i-j]+h[i]; } int main() { catelan(); while(1) { n=read();tot++; if(n==-1) break; printf("%d %d %I64d\n",tot,n,2*h[n]); } return 0; }
标签:sim limit getch 最短路径 show lan ssi 礼物 pre
原文地址:http://www.cnblogs.com/z360/p/7338272.html