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

建议使用的浏览器:

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

6051:If the starlight never fade

题目描述
We will give you a non-negative integer $m$ and a prime number $p$.
And we define $f\left(i\right)$ is the number of pair$\left(x,y\right)$ that satisfies $\left(x + y\right) ^ {i} \equiv x ^ {i} \% p$ and $1 \leq x \leq p - 1,1 \leq y \leq m$.
Now, you have to calculate the sum $\sum_{i=1}^{p-1}if\left(i\right)$.
Maybe the sum is too big,so you only need to output the sum after mod $1e9+7$.
输入解释
The first line contains only one integer $T$, which indicates the number of test cases.
For each test case, there are a integer $m \left(1 \leq m \leq p - 1 \right)$ and a prime number $p\left(2 \leq p \leq 1e9 + 7 \right)$ on one line.
输出解释
For each test case, output one line "Case #x: y", where x is the case number (starting from 1) and y is the sum after mod $1e9+7$.
输入样例
3
5 7
3 11
2 103
输出样例
Case #1: 210
Case #2: 390
Case #3: 50388
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6051

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

共提交 0

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