ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

I've got WA on problem №1110. How can I attach this problem to title "задача"
Posted by practicant 21 Aug 2008 22:03
Here is my code. Please help to find mistake.
#include <stdio.h>
void main()
{
int x,n,m,y,p,i,s,u;
vv:
scanf("%d",&n);
scanf("%d",&m);
scanf("%d",&y);
if (n<=0 || n>=999 || m<=1 || m>=999 || y<=0 || y>=99) goto vv;
u=-1;
s=0;
x=0;
while (x<=(m-1))
{
 p=1;
 for (i=1; i<=n; i++)
 {
  p=p*x;
 }
 if ((p % m) == y)
 {
 printf("%d ",x);
 s++;
 }
 x++;
}
 if (s==0)
 printf("%d\t",u);
}