https://onlinegdb.com/H1CqGa7HI
i am unable to find error in my code , i have used matrix exponantiation to find the fibonacci numbers , and used euclids algorithm to calculate gcd , i dont know why is it giving wrong answers , please HELP !
Review my code please
Could you please provide the code in Coding Blocks IDE.
As the code is not editable in the IDE provided by you, and is highly compact. I am interpreting that you are creating a segment tree of fib number but this will result in overflow.
This question utilizes a property of fib numbers that GCD(fib(a),fib(b))=fib(GCD(a,b)).
You need to create a segment tree on the A[i]'s GCD.
You may refer to this code.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.