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

建议使用的浏览器:

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

5377:Root

题目描述
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$)
输入解释
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)$
输出解释
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.
输入样例
1
175 2
2 1
2 3
输出样例
Case #1:
0
3
提示
$175\ =5^2*7$  

$2^0\ mod\ 5\ =\ 1$  

$2^3\ mod\ 7\ =\ 1$  

So the answer to (2,1) is 0
来自杭电HDUOJ的附加信息
Author UESTC
Recommend wange2014

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

源链接: HDU-5377

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

共提交 0

通过率 --%
时间上限 内存上限
30000/15000MS(Java/Others) 262144/262144K(Java/Others)