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

建议使用的浏览器:

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

6159:Graph Of Zhuper

题目描述
We define $Zhu(G)$ as the value of $G$.( $G$ is labeled undirected graphs with $n$ nodes( self-loop and multiple edge are not allowed ) ).

The method of calculating Zhu(G) is easy , if $G$ has $K$ connected components, then Zhu(G) = $gcd(size_1,size_2,...,size_k)$

* $size_k$ is the number of vertexs in connected component $k$

Now, Shen wants to know $\sum_{}{}Zhu(G)$, can you help him?

Because the answer may be large, so you are only need to output the answer modulo $P$.
输入解释
The first line is an integer T($1 \leq T \leq 10$) describe the number of test cases.

For each testcase, the first line contains two numbers $n$ and $P$.

You can assume that $1 \leq n \leq 30000 , 100000000 \leq P \leq 1000000009$

There are no more than $5$ testcases with $n \geq 10000$.

It is guaranteed that $P$ is a prime number.
输出解释
For the $k$th test case , first output "Case #k: " , then output an integer as answer in a single line.
输入样例
3
1 1000000007
2 1000000007
3 1000000007
输出样例
Case #1: 1
Case #2: 3
Case #3: 16
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6159

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

共提交 0

通过率 --%
时间上限 内存上限
24000/12000MS(Java/Others) 256000/256000K(Java/Others)