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 1013. K-based Numbers. Version 3

Loop in python
Posted by crc 21 Jan 2015 20:27
a "for"-loop in python for integers 1 <= i <= 10^18 needs a lot of time. Is there a way to avoid to do such a huge for-loop?


Edited by author 21.01.2015 20:28
Re: Loop in python
Posted by LNCP 7 Feb 2015 18:55
You should calculate recurrence with Matrix and use quick-power to calculate the power of Matrix.Do you need details about the algo?