提交时间:2020-08-23 20:11:32
运行 ID: 6134
#include<bits/stdc++.h> using namespace std; int a1[30]={0}; int day(int a){ if(a==1)return 1; if(a==2)return 2; if(a1[a]!=0)return a1[a]; return a1[a]=day(a-1)+day(a-2); } int main(){ int a; cin>>a; for(int i=1;i<=a;i++){ int b; cin>>b; cout<<day(b)<<endl; } }