杭电ACM1395,请路过的大牛看看为什么WA? http://acm.hdu.edu.cn/showproblem.php?pid=1395
#include<stdio.h>intmain(){__int64n,i,t,s;while(scanf("%I64d",&n)!=EOF){if(n%2==0)pri...
#include<stdio.h>
int main()
{
__int64 n,i,t,s;
while(scanf("%I64d",&n)!=EOF)
{
if(n%2==0)
printf("2^? mod %I64d = 1\n",n);
else if(n==1)
printf("2^0 mod %I64d = 1\n",n);
else
{
s=2;
t=1;
while(s!=1)
{
s=s*2%n;
t++;
}
printf("2^%I64d mod %I64d = 1\n",t,n);
}
}
return 0;
} 展开
int main()
{
__int64 n,i,t,s;
while(scanf("%I64d",&n)!=EOF)
{
if(n%2==0)
printf("2^? mod %I64d = 1\n",n);
else if(n==1)
printf("2^0 mod %I64d = 1\n",n);
else
{
s=2;
t=1;
while(s!=1)
{
s=s*2%n;
t++;
}
printf("2^%I64d mod %I64d = 1\n",t,n);
}
}
return 0;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询