1、hdu 1715 大菲波数
2、链接:http://acm.hdu.edu.cn/showproblem.php?pid=1715
3、总结:水
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
#include<iostream> #include<cstring> #include<cmath> #include<queue> #include<algorithm> #include<cstdio> #define max(a,b) a>b?a:b using namespace std; #define LL long long #define INF 0x3f3f3f3f int fib[1010][300]; void cal() { fib[1][1]=fib[2][1]=1; fib[1][0]=fib[2][0]=1; int i,j,num=2; for(i=3;i<1010;i++){ for(j=1;j<num;j++){ int num1=fib[i-2][j]+fib[i-1][j]+fib[i][j]; fib[i][j]=num1%10; fib[i][j+1]=num1/10; } if(fib[i][num])num++; fib[i][0]=num-1; } } int main() { memset(fib,0,sizeof(fib)); cal(); int n,m; scanf("%d",&n); while(n--) { scanf("%d",&m); for(int i=fib[m][0];i>0;i--) { printf("%d",fib[m][i]); } printf("\n"); } return 0; }