MazzForces's blog

By MazzForces, history, 7 years ago, In English


Today, I was trying to solve this problem. The Dp behind this problem is not very difficult and is not the tricky part of the problem according to me.

The part that I have completely failed to to understand in this problem is where we are required to calculate ( Pi * 10002N%(1e9 + 7)). The author meintions in the problem statement that this (( Pi * 10002N%(1e9 + 7))) is guaranteed to be an integer.

Can somebody please provide me a proof of this or just simplify the formula ? I have complete idea about how to approach this problem with doubles without Modulo, but have no idea about doing this with the formula above. How do I calculate the probability  * 10002N%(1e9 + 7) ? Help !

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

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

If you can calculate probability modulo P then just multiply answer by 10002N. It can be done by calculating 2N modulo P - 1 and use this theorem calculating answer