|
|
back to boardWA on 4th. Can help? If ((a mod c)*(b mod c)) mod c = a*b mod c? program power_1110_cod2; {$APPTYPE CONSOLE} var n,m,y:integer; cou:integer; met,met2:boolean; function modalus(mx,mn,mm:integer):integer; var mcou:integer; mmn:integer; begin mmn:=1; for mcou:=1 to mn do begin mmn:=mmn*(mx mod mm); end; modalus:=mmn mod mm; end; begin readln(n,m,y); if y=0 then begin write(0); met2:=true; met:=true; end else met2:=false; for cou:=1 to m-1 do if modalus(cou,n,m)=y then begin if met2=true then begin write(' '); write(cou); met:=true; end else begin write(cou); met:=true; met2:=true; end; end; if met=false then writeln(-1) else writeln; end. |
|
|