Root

TimeLimit:15000MS  MemoryLimit:262144KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
Given a number $sum(1\leq sum \leq 100000000)$,we have $m$ queries which contains a pair ($x_i,y_i$) and would like to know the smallest nonnegative integer $k_{i}$ satisfying $x_i^{k_{i}}=y_i\ mod\ p$ when the prime number $p\ (sum\ mod\ p = 0)$(ps:$0^0=1$)
Input
The first line contains a number T, indicating the number of test cases.

For each case, each case contains two integers $sum,m(1\leq sum\leq 100000000,1\leq m\leq 100000)$ in the first line.

The next $m$ lines will contains two intgeers $x_i,y_i(0\leq x_i,y_i\leq1000000000)$
Output
For each test case,output "Case #$X$:" and $m$ lines.($X$ is the case number)

Each line cotain a integer which is the smallest integer for ($x_i,y_i$) ,if we can't find such a integer just output "-1" without quote.
SampleInput
1
175 2
2 1
2 3
SampleOutput
Case #1:
0
3
 Hint $175\ =5^2*7$ $2^0\ mod\ 5\ =\ 1$ $2^3\ mod\ 7\ =\ 1$ So the answer to (2,1) is 0
Submit
题目统计信息详细
总AC数3
通过人数3
尝试人数3
总提交量4
AC率75.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签
出处

T^T Online Judge

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