|
|
вернуться в форумWhy WA on test#8? program ural1110; var n,m,x,r,i:integer; y:byte; first:boolean; begin readln(n,m,y); first:=true; for x:=0 to m-1 do begin r:=1; for i:=1 to n do r:=(r*x) mod m; if r=y then begin if first then first:=false else write(' '); write(x); end; end; if first then writeln(-1) else writeln; end. Check your mail - I've sent you explanation of your mistake (-) Re: Why WA on test#8? program ural1110; var n,m,x,r,i:longint; y:longint; first:boolean; begin readln(n,m,y); first:=true; for x:=0 to m-1 do begin r:=1; for i:=1 to n do r:=(r*x) mod m; if r=y then begin if first then first:=false else write(' '); write(x); end; end; if first then writeln(-1) else writeln; end. |
|
|