Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdio>
- #define mod 1000000007
- using namespace std;
- int main(){
- long long int num1 = 0, num2 = 1, num3, i, results[1000];
- results[0] = num1, results[1] = num2;
- for(i = 2; i < 1000; i++){
- num3 = num1 + num2;
- num3 %= mod;
- num1 = num2; num2 = num3;
- results[i] = num3;
- }
- int t; scanf("%d", &t);
- while(t--){
- int n; scanf("%d", &n);
- printf("%lld\n", results[n]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement