Project Euler #140: Modified Fibonacci golden nuggets

Sort by

recency

|

4 Discussions

|

  • + 0 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/

  • + 0 comments

    How to solve the diophantine equation x^2-5*y^2=d???

  • + 1 comment

    Are there any additional restrictions on T, L, and R for the final test case?

  • + 1 comment

    There seems to be a typo, either G2 is 1 or series Ag(1/2) is wrong. If I am to use the provided Gk series (1,4,5,9,14,...), Ag(1/2) is larger than 2 from the first 3 terms.

No more comments