当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5446:Unknown Treasure

题目描述
On the way to the next secret treasure hiding place, the mathematician discovered a cave unknown to the map. The mathematician entered the cave because it is there. Somewhere deep in the cave, she found a treasure chest with a combination lock and some numbers on it. After quite a research, the mathematician found out that the correct combination to the lock would be obtained by calculating how many ways are there to pick $m$ different apples among $n$ of them and modulo it with $M$. $M$ is the product of several different primes.
输入解释
On the first line there is an integer $T (T \leq 20)$ representing the number of test cases.

Each test case starts with three integers $n, m, k (1 \leq m \leq n \leq 10^{18}, 1 \leq k \leq 10)$ on a line where $k$ is the number of primes. Following on the next line are $k$ different primes $p_1, . . . , p_k$. It is guaranteed that $M = p_1 · p_2 · · · p_k ≤ 10^{18}$ and $p_i \leq 10^5$ for every $i ∈ \{1, . . . , k\}$.
输出解释
For each test case output the correct combination on a line.
输入样例
1
9 5 2
3 5
输出样例
6
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5446

最后修改于 2020-10-25T23:22:44+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1500/1000MS(Java/Others) 131072/131072K(Java/Others)