If the starlight never fade

TimeLimit:1000MS  MemoryLimit:65536KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
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$.
Input
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.
Output
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$.
SampleInput
3
5 7
3 11
2 103
SampleOutput
Case #1: 210
Case #2: 390
Case #3: 50388
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签
出处

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: