提交时间:2020-10-31 19:44:32

运行 ID: 8360

#include<bits/stdc++.h> using namespace std; int a1[50]={0}; int main(){ int a; cin>>a; a1[1]=2; a1[2]=3; a1[3]=5; for(int i=3;i<=30;i++){ a1[i]=a1[i-1]+a1[i-2]; } for(int i=1;i<=a;i++){ int n; scanf("%d",&n); printf("%d\n",a1[n]); } }