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 1528. Sequence

So Fast Solution
Posted by M@STeR.SoBG 31 May 2008 02:46
How can i solve this problem with time < 1s?? My result is 1.8 s. Could anybody answer me??
Re: So Fast Solution
Posted by Seyyed Mehran Kholdi 1 Jul 2008 17:09
The same question. I got AC in 1.7 sec, how to make it faster?

Edited by author 01.07.2008 18:46
Re: So Fast Solution
Posted by Dmitriy Black 2 Jan 2012 03:34
You should minimize the number of mod operations. for example when I use mod each iteration i got 0.9 sec. But when I minimized the number of mod operations I got 0.56 sec. You should use long f(java) and calculate (f mod p) when f > 10^14, but not each time you calculate your f.