Can Some one help me? Why WA?
Послано
MTest 11 сен 2005 12:02
#include<stdio.h>
#include<math.h>
proc(int x,int n,int m)
{
int tn;
if(n%2)
tn = 1;
else
tn = 2;
while(pow(x,tn) < m && tn < n && tn+2 <= n)tn+=2;
return long(pow(x,tn))%m;
}
main()
{
int n,m,y,chk = 0;
scanf("%d%d%d",&n,&m,&y);
for(int x = 0; x < m; x++)
if(proc(x,n,m) == y)
{
chk++;
printf("%d ",x);
}
if(!chk)
printf("-1");
return 0;
}