提交时间:2023-11-07 20:27:15
运行 ID: 30349
#include<iostream> using namespace std; int fib[510]; int fibo(int n){ if(fib[n]!=0) return fib[n]; if(n<=2) fib[n]=1; else fib[n]=fibo(n-1)+fibo(n-2); return fib[n]; } int main() { int m; cin>>m; while(m--){ int a; cin>>a; cout<<fibo(a)<<endl; } return 0; }