题目地址:​​点击打开链接​

思路:水题

AC代码:

#include <iostream>

using namespace std;

int main()
{
int i,n,b;
int a[41] = {0,1,1};
for(i=3; i<=40; i++)
{
a[i] = a[i-1] + a[i-2];
}
cin>>n;
while(n--)
{
cin>>b;
cout<<a[b]<<endl;
}
return 0;
}