提交时间:2020-08-23 19:43:20

运行 ID: 6105

#include<bits/stdc++.h> using namespace std; int k[100000]={0}; int upstair1(int stairs1){ if(stairs1<=1)return 1; if(k[stairs1]==0)return k[stairs1]; k[stairs1]=upstair1(stairs1-1)+upstair1(stairs1-2); return k[stairs1]; } int main(){ int n; cin>>n; while(n--){ int a; cin>>a; cout<<upstair1(a)<<endl; } return 0; }