ZOJ 1489 运行正确,WA,应该是求最小X地方错了,真心求改正ZOJ Problem Set - 14892^x mod n = 1--------------------------------------------------------------------------------Time Limit:1 Second Memory Limit:32768 KB ---------------------
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 22:43:17
ZOJ 1489 运行正确,WA,应该是求最小X地方错了,真心求改正ZOJ Problem Set - 14892^x mod n = 1--------------------------------------------------------------------------------Time Limit:1 Second Memory Limit:32768 KB ---------------------
ZOJ 1489 运行正确,WA,应该是求最小X地方错了,真心求改正
ZOJ Problem Set - 14892^x mod n = 1
--------------------------------------------------------------------------------
Time Limit:1 Second Memory Limit:32768 KB
--------------------------------------------------------------------------------
Give a number n,find the minimum x that satisfies 2^x mod n = 1.
Input
One positive integer on each line,the value of n.
Output
If the minimum x exists,print a line with 2^x mod n = 1.
Print 2^?mod n = 1 otherwise.
You should replace x and n with specific numbers.
Sample Input
2
5
Sample Output
2^?mod 2 = 1
2^4 mod 5 = 1
-------------------------------------------------------------------------------------------
#include
#include
int main()
{
int n,x,i,count,a;
scanf("%d",&n);
if(n%2==1)
{
a=1;
for(x=1;x
ZOJ 1489 运行正确,WA,应该是求最小X地方错了,真心求改正ZOJ Problem Set - 14892^x mod n = 1--------------------------------------------------------------------------------Time Limit:1 Second Memory Limit:32768 KB ---------------------
#include
#include
int main()
{
int n,x,i,count,a;
while(scanf("%d",&n)==1) // 多组输入
{
count=0; // 初始化count
if(n%2==1)
{
a=1;
for(x=1;x