|
|
back to boardWhy got WA? Posted by Akv0 29 Mar 2003 20:54 here are my program: var n,t,m,y,i,j,k:integer; a:array[1..1000] of integer; yes:boolean; BEGIN readln(n,m,y); k:=0; yes:=false; for i:=0 to m-1 do begin t:=i; for j:=2 to n do t:=sqr(t) mod m; if t=y then begin yes:=true; inc(k); a[k]:=i; end; end; if not yes then writeln('-1') else begin for i:=1 to k-1 do write(a[i],' '); writeln(a[k]); end; END. |
|
|