#include<stdio.h> #include<string.h> #define N 500 int main() { int i,j,n,p,f2[N],f1[N],f0[N]; scanf("%d",&n); while(n--) { scanf("%d",&p); memset(f0,0,sizeof(f0)); memset(f1,0,sizeof(f1)); memset(f2,0,sizeof(f2)); f0[0]=1;f1[0]=1;f2[0]=1; if(p==1||p==2) { printf("1/n"); continue; } for(i=0;i<p-2;i++) { for(j=0;j<N;j++) f2[j]=f1[j]+f0[j]; for(j=0;j<N;j++) if(f2[j]>9) { f2[j]-=10; f2[j+1]++; } for(j=0;j<N;j++) { f0[j]=f1[j]; f1[j]=f2[j]; } } for(i=N-1;i>=0;i--) if(f2[i]) break; for(j=i;j>=0;j--) printf("%d",f2[j]); printf("/n"); } }
posted on 2010-04-13 15:15 草头菜 阅读(108) 评论(0) 编辑 收藏 举报
Powered by: 博客园 Copyright © 2024 草头菜 Powered by .NET 8.0 on Kubernetes