You are viewing a single comment's thread. Return to all comments →
#include <iostream> #include <vector> #include <algorithm> #include <math.h> #include <numeric> #include <fstream> #include <string.h> #include <stdlib.h> long long int md=1000000007; using namespace std; long long int f(long long int l) { long long int F[2*l+3]; long long int i; F[0] = 1; F[1] = 1; for (i = 2; i <= 2*l+1; i++) { F[i]= (F[i-1]%md + F[i-2]%md)%md; } return ((F[2*l]%md)*(F[(2*l)+1]%md))%md; } int main() { long long int t; cin>>t; while(t--){ long long int l ,r,sum=0; cin>>l>>r; for(int i=l-1;i<=r-1;i++) // sum=(sum%md+f(i)%md)%md; sum=f(l); cout<<sum<<endl; } return 0; }
hey can anyone tell me where i am wrong https://www.mathblog.dk/project-euler-137-fibonacci-golden-nuggets/
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #140: Modified Fibonacci golden nuggets
You are viewing a single comment's thread. Return to all comments →
hey can anyone tell me where i am wrong https://www.mathblog.dk/project-euler-137-fibonacci-golden-nuggets/