Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

FayedAnik_'s blog

By FayedAnik_, history, 5 years ago, In English

Hi!every one! I am stuck in this problem https://www.spoj.com/problems/PON/ ! I am trying to solve it with miller rabin primality test. But got tle :-( my solution can be found here https://ideone.com/eSoJpz Can anyone help ? thanks in advance :-)

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

In your fastexpo(), you should consider using your multiply() when multiplying two numbers. Because say you are doing a * b % MOD, here all of these numbers can big as big as 1018 which will surely cause overflow.