nirwandogra's blog

By nirwandogra, 12 years ago, In English

SPOJ Problem POWPOW Here is my code....... http://ideone.com/t29P3j

mod=1000000003 ,phi_mod=500000003

I have done it as follows--- --X congruent exp mod 500000003 ---X congruent 1 mod 2 ---solve for X using CRT.... ---X is (2nCn %(mod-1)) --then do ans1=powmod(X^b,mod-1) ----ans2=powmod(a^ans1,mod) print ans2 It is giving WA

  • Vote: I like it
  • -8
  • Vote: I do not like it

»
7 years ago, # |
  Vote: I like it +5 Vote: I do not like it

I know this is 5 years ago, but for those who come next ... check this Quora question