1. 程式人生 > >Codeforces Problem 711E ZS and The Birthday Paradox(抽屜原理+乘法逆元+費馬小定理+組合數+快速冪+概率論)

Codeforces Problem 711E ZS and The Birthday Paradox(抽屜原理+乘法逆元+費馬小定理+組合數+快速冪+概率論)

ZS the Coder has recently found an interesting concept called the Birthday Paradox. It states that given a random set of 23 people, there is around 50% chance that some two of them share the same birthday. ZS the Coder finds this very interesting, and decides to test this with the inhabitants of Udayland.

In Udayland, there are days in a year. ZS the Coder wants to interview k people from Udayland, each of them has birthday in one of days (each day with equal probability). He is interested in the probability of at least two of them have the birthday at the same day.

ZS the Coder knows that the answer can be written as an irreducible fraction

. He wants to find the values of A and B (he does not like to deal with floating point numbers). Can you help him?