n | 0 | 1 | 2 | 3 | 4 |
---|---|---|---|---|---|
a | 1 | 2 | 3 | 5 | 8 |
b | 0 | 1 | 2 | 3 | 5 |
附上代码
#include
#define int long long
using namespace std;
const int INF=0x3f3f3f3f;
const int N=1e5+5;
const int M=1e9+7;
typedef long long ll;
typedef pair<int,int> PII;
ll a[90];
void f(){
a[0]=0;
a[1]=1;
a[2]=2;
for(ll i=3;i<=84;i++){
a[i]=a[i-1]+a[i-2];
}
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
ll t;
cin>>t;
f();
while(t--){
ll n;
cin>>n;
cout<<a[n+1]+a[n]<<endl;
}
return 0;
}