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

Please, give me some test!!!
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);
  readln(N,M,Y);
  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.
And what about -1? (-)
Posted by shitty.Mishka 7 Jun 2002 13:32
The answer for test
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
> The answer for test
> 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
_______
Answer: 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
_______
Answer: 0

No, because X in the interval [0, M − 1]
I think answer is -1
Re: Please, give me some test!!!
Posted by Megakrit 15 Jan 2013 23:40
Since, (0 < N < 999, 1 < M < 999, 0 < Y < 999)
the minimum input is:
1 2 1
with the answer
1
Re: Please, give me some test!!!
Posted by maksim32 27 Oct 2015 21:20
Megakrit, This is best test! Thank you!

Edited by author 27.10.2015 21:21