题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2067
#include<bits/stdc++.h> using namespace std; typedef unsigned int ui; typedef long long ll; typedef unsigned long long ull; #define pf printf #define mem(a,b) memset(a,b,sizeof(a)) #define prime1 1e9+7 #define prime2 1e9+9 #define pi 3.14159265 #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define scand(x) scanf("%llf",&x) #define f(i,a,b) for(int i=a;i<=b;i++) #define scan(a) scanf("%d",&a) #define mp(a,b) make_pair((a),(b)) #define P pair<int,int> #define dbg(args) cout<<#args<<":"<<args<<endl; #define inf 0x7ffffff inline int read(){ int ans=0,w=1; char ch=getchar(); while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();} while(isdigit(ch))ans=(ans<<3)+(ans<<1)+ch-'0',ch=getchar(); return ans*w; } int n,m,t; const int maxn=40; const ll mod=10000; ll a[maxn]; int main() { // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); std::ios::sync_with_stdio(false); a[0]=1; for(int i=1;i<maxn-1;i++){ ll b=0; for(int j=0;j<=i-1;j++){ b+=(a[j]*a[i-j-1]); } a[i]=b; } t=0; while(cin>>n){ if(n==-1)return 0; cout<<++t<<" "<<n<<" "<<a[n]*2<<endl; } }