Adityaxv's blog

By Adityaxv, 2 months ago, In English

Problem

According to me P = 85 and Q = 10. So, the answer should be 8. But why the expected answer is 500000012?

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

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

perform modular division(Fermat's Theorem) on it you will get that o/p My Solution

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Yeah you are right, 85/10 = 8.

I think the authors made a mistake probably.

And we should do a complete retesting for all those who got AC during the contest.

»
2 months ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

you need to calculate $$$Q^{-1}$$$ mod $$$10^9 + 7$$$ using Fermat's theorem (modular inverse) which is $$$700000005$$$, then multiply it by $$$85$$$ mod $$$10^9 + 7$$$, which is equal to $$$500000012$$$