#abc241h. Ex - Card Deck Score
Ex - Card Deck Score
Score : points
问题描述
存在一些卡片,每张卡片上都写有一个来自 个整数中的一个。具体来说,有 张卡片上面写着整数 。
接下来,对于从这 张卡片中选出的 张卡片的组合,我们定义该组合的得分是这 张卡片上所写整数的乘积。
假设写有相同整数的卡片是不可区分的,求所有可能的 张卡片组合的得分之和,对 取模的结果。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are some cards. Each card has one of integers written on it. Specifically, there are cards with written on them.
Next, for a combination of cards chosen out of these cards, we define the score of the combination by the product of the integers written on the cards.
Supposed that cards with the same integer written on them are indistinguishable, find the sum, modulo , of the scores over all possible combinations of cards.
Constraints
- If , then .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 3
3 1
5 2
6 3
Sample Output 1
819
There are possible combinations of cards.
- A combination of card with written on it, and cards with written on them.
- A combination of card with written on it, card with written on it, and card with written on it.
- A combination of card with written on it, and cards with written on them.
- A combination of cards with written on them, and card with written on it.
- A combination of card with written on it, and cards with written on them.
- A combination of cards with written on them.
The scores are , , , , , and , respectively, for a sum of .
Sample Input 2
3 2
1 1
5 2
25 1
Sample Output 2
180
"A combination of a card with and another card with " and "a combination of two cards with written on them" have the same score of , but they are considered to be different combinations.
Sample Input 3
10 232657150901347497
139547946 28316250877914575
682142538 78223540024979445
110643588 74859962623690081
173455495 60713016476190629
271056265 85335723211047202
801329567 48049062628894325
864844366 54979173822804784
338794337 69587449430302156
737638908 15812229161735902
462149872 49993004923078537
Sample Output 3
39761306
Be sure to print the answer modulo .
update @ 2024/3/10 10:24:34