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

建议使用的浏览器:

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

7111:Remove

题目描述
Kris is playing a game, which involves removing stones from a pile that initially consists of $n$ stones. He is given a set of prime numbers $P$, and each time he is able to choose one $p$ from $P$ and remove $m\bmod p$ stones from the pile, where $m$ stands for the number of stones remaining in the pile. The game finishes once no stone is left in the pile, and he wants to put an end to the game using least number of rounds possible.

Given $N$, you are expected to calculate the minimum rounds $a_n$ required to finish the game starting with a pile of $n$ stones for all $1\le n\le N$. And if there is no possible solution for certain $n$, we set $a_n=0$. And in order to prevent large output, you only need to print $\left(\sum_{1\le n\le N}a_n\times 23333^{N-n}\right)\bmod 2^{64}$.
输入解释
This problem contains multiple test cases.

The first line contains an integer $T(1\le T\le 60)$, the number of test cases.

Each case starts with a line of two integers $N,|P|(1\le N\le 2\times 10^6, 1\le |P|\le 10^5)$.

Then $|P|$ prime integers follow, denoting the set. It is guaranteed that the primes are pairwise different and do not exceed $N$.

There will be no more than $15$ test cases where $N\ge 20000$.
输出解释
Output $T$ lines, each line contains an integer, the answer for the corresponding test case.
输入样例
1
6 2
2
3
输出样例
17181031198765592570
来自杭电HDUOJ的附加信息
Hint In the sample case, ai is {1,1,2,3,3,0}.

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

源链接: HDU-7111

最后修改于 2021-10-23T19:11:32+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/3000MS(Java/Others) 262144/262144K(Java/Others)