ac代码:
int a[1006][504] ={0};
int main()
{
int n, m, i, j, k;
a[1][0] = 1; a[2][0] = 1;
for(i = 3; i <= 1000; i++)
{
k = 0;
for(j = 0; j <= 500; j++)
{
a[i][j] = a[i-1][j]+a[i-2][j]+k;
k = a[i][j]/10;
a[i][j] = a[i][j]%10;
}
}
scanf("%d",&n);
while(n--){
scanf("%d",&m);
for(i = 500; ; i--)
if(a[m][i] != 0){ break; }
for( ; i != -1; i--)
printf("%d",a[m][i]);
printf("\n");
}
}