ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1462. Uncle Scrooge's Gold

Recursion
Posted by Cybernetics Team 21 Aug 2006 19:38
Today I solved this problem using some nice (and easy to find) formulas for computing F[n]:
F[2n] = F[n]*(F[n-1] + F[n+1]) and
F[2n-1] = F^2[n-1] + F^2[n]
with these you cand recursevly compute F[n] fast enough (~0.25 sec). I also precalculated a table with first 2000 Fibonacci and when the recursion dropped below 2000 it returned the computed value.
I see some nice times on the best AC list. Will you please tell us how you did it? What formulas, optimizations...
Thank you
Re: Recursion
Posted by Kaliningrad SU -J_A_MES-HeadLiner 22 Aug 2006 01:32
Where can I find fast(n*log(n))long multiplication in acceptable form?
Re: Recursion
Posted by SPIRiT 18 Sep 2006 18:33
From what index do you start? F(0)=1 and F(1)=1 or not?
Cause I have such formulas:
F(2n+1)=F(N)*(F(n-1)+F(n+1));
F(2n)=F^2(N)+F^(N-1)