#abc243f. F - Lottery
F - Lottery
Score : points
问题陈述
高桥正在参加一个彩票抽奖活动。
每次抽奖时,他都会获得 个奖品中的一个。第 个奖品被抽中的概率为 。每次抽奖的结果都是相互独立的。
请问,在进行 次抽奖后,他恰好获得 个不同奖品的概率是多少?请计算结果并以 取模。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi is participating in a lottery.
Each time he takes a draw, he gets one of the prizes available. Prize is awarded with probability . The results of the draws are independent of each other.
What is the probability that he gets exactly different prizes from draws? Find it modulo .
Note
To print a rational number, start by representing it as a fraction . Here, and should be integers, and should not be divisible by (under the Constraints of this problem, such a representation is always possible). Then, print the only integer between and (inclusive) such that .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
2 1 2
2
1
Sample Output 1
221832079
Each draw awards Prize with probability and Prize with probability .
He gets Prize at both of the two draws with probability , and Prize at both draws with probability , so the sought probability is .
The modulo representation of this value, according to Note, is .
Sample Input 2
3 3 2
1
1
1
Sample Output 2
0
It is impossible to get three different prizes from two draws, so the sought probability is .
Sample Input 3
3 3 10
499122176
499122175
1
Sample Output 3
335346748
Sample Input 4
10 8 15
1
1
1
1
1
1
1
1
1
1
Sample Output 4
755239064
update @ 2024/3/10 10:27:43