Source Code

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int OO = 1e9+7 ,N=1e6+5;

int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 }; // dir array
int dy[] = { 1, -1, 0, 0, 1, -1, -1, 1 };
void File(){
#ifndef ONLINE_JUDGE
    freopen("Input.txt", "r", stdin);
    freopen("Output.txt", "w", stdout);
#endif
}
int febo[N];
int solve(){
    int n;cin>>n;
    cout<<febo[n]<<'\n';
    return 0;
}
int main() {
    File();
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    febo[1]=1,febo[2]=2;
    for(int i=3;i<=1e6;i++){
        febo[i]=(febo[i-1]+febo[i-2])%OO;
    }
    int t,i=1;cin>>t;
    while(t--)
        solve();

}
//Solve on paper first
//Overflooooooow
//Reverse Thinking
//If there's an equation, transform it into an easy one
//READ ALL PROBLEMS
//Verify Your thought before Coding
Copy
Study Schedule ahmes
GNU G++17
39 ms
5.3 MB
Accepted