这道题考察的知识点其实就是斐波那契数列
下面附上已AC的代码:
#include<stdio.h>
int main()
{
int x[21],i,T,N;
x[0]=0;
x[1]=1;
x[2]=2;
x[3]=3;
scanf("%d",&T);
for(i=4;i<=20;i++)
x[i]=x[i-1]+x[i-2];
while(T--)
{
scanf("%d",&N);
printf("%d\n",x[N]);
}
return 0;
}