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

Discussion of Problem 1110. Power

wa #8
Posted by jet-pilot 6 Sep 2011 19:22
What is in this test and what is wright answer?
Re: wa #8
Posted by sftuit 21 Oct 2011 13:59
var  n,m,y,i,x,j:longint;
   yes:boolean;
begin
    read(n,m,y);
    yes:=false;
    for i:=0 to m-1 do
    begin
        x:=i;
        if (n=0)then x:= 1;
        for j:=2 to n do
            x:=(x*i) mod m;
        if x mod m=y then
        begin
            yes:=true;
            write(i,' ');
        end;
    end;
    if yes=false then write('-1');
end.