Блог пользователя MazzForces

Автор MazzForces, история, 7 лет назад, По-английски

Hello,

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 !

  • Проголосовать: нравится
  • -6
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

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