ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1110. Power

Posted by Algorithmus_UA(algorithmus@univ.kiev.ua) 6 Jun 2002 17:57
I take WR!!! I don't know what s wrong!!!
---------------------------------MY PROGRAM-------------------------
var N,M,Y:longint;
a:array[1..15]of byte;
b:array[1..15]of longint;
d:array[1..1000]of integer;
h,x,l:integer;
i,j,s:longint;
begin
assign(input,'1110.dat');
reset(input);
x:=N;
for i:=1 to 15 do
begin
a[i]:=x mod 2;
x:=x div 2;
if x = 0 then break;
end;
l:=i;
for i:=0 to M-1 do
begin
b[1]:=i;
for j:=2 to l do
begin
b[j]:=(b[j-1]*b[j-1]) mod M;
end;
s:=1;
for j:=1 to l do if a[j]=1 then
begin
s:=(s*b[j]) mod M;
end;
if s = Y then
begin
inc(h);
d[h]:=i;
end;
end;
for i:=1 to h-1 do write(d[i],' ');
if h<>0 then writeln(d[h]);
end.
Posted by shitty.Mishka 7 Jun 2002 13:32
1 2 3
Should be
-1

GL
Thanks now I got AC
Posted by Algorithmus_UA(algorithmus@univ.kiev.ua) 21 Sep 2002 13:48
> 1 2 3
> Should be
> -1
>
> GL
Re: Please, give me some test!!!
Posted by Lochinbek_Boboyev_TUIT 7 Dec 2012 17:54
0 0 0
_______
Re: Please, give me some test!!!
Posted by [TH0412]tdson 27 Dec 2012 08:14
Lochinbek_Boboyev_TUIT wrote 7 December 2012 17:54
0 0 0
_______

No, because X in the interval [0, M − 1]