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

建议使用的浏览器:

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

6650:Equation

题目描述
Cuber QQ has encountered a math problem during his research of "nothing related to math", he thought the problem too boring for him, and decided to leave it to you. You might be curious about more background about why this problem appeared in his research, but to save your time, let's say "the background isn't helpful for you to solve this problem".

Given $n$, $m$, count the number of sequence $x_1, x_2, \ldots, x_n$ such that $x_1^2 + x_2^2 + \cdots + x_{n-1}^2 \equiv x_n^2 \pmod m$ and $0 \le x_i < m$ for $1 \le i \le n$. $m$ is odd in this problem.
输入解释
The first line of the input is an integer $t$ ($1 \le t \le 2500$), where $t$ is the number of test cases.

Then follows $t$ test cases, each of which is a line with two space-separated integers $n$ and $m$ ($3 \le n \le 100, 3 \le m \le 999~999~999$ and $m$ is odd).
输出解释
For each test case, output the answer modulo $10^9 + 7$.
输入样例
3
3 5
5 3
9 101
输出样例
25
81
980480839
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6650

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

共提交 0

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