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

Common Board

I try this program for 1024 but it gets WA.
Posted by VaheTry1 1 Apr 2003 18:07
What's wrong
var
    dig : array[2..36] of byte;
    maxn ,tiv,i: byte;
    c ,max : char;
b : boolean;
begin
b := True;
   read(c);
   repeat
      if (c > max) then
      begin
         max := c;
         if max in ['A'..'Z'] then
            maxn := ord(c) - 55
         else
            maxn := ord(c) - 48;
      end;
      if c in ['A'..'Z'] then
         tiv := ord(c) - 55
      else tiv := ord(c) - 48;
      for i := maxn + 1 to 36 do
      begin
         if (i <> 1) then
         dig[i] := (dig[i]*i + tiv) mod (i-1);
      end;
      read(c);
   until not (c in ['0'..'9','A'..'Z']);
   for i := maxn + 1 to 36 do
      if (dig[i] = 0) then
      begin
         write(i);
     b := False;
         break;
      end;
if (b) then writeln('No solution.')
end.