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 1104. Don’t Ask Woman about Her Age

What's wrong with my program??I got WA many times!!
Posted by Ural_BeeLiang 25 Nov 2002 15:54
var
  remain: array[2..36]of longint;
  p: char;
  i, num, max: integer;
begin
  fillchar(remain, sizeof(remain), 0);
  max := 0;
  while not eof do
  begin
    read(p);
    if p in ['0'..'9'] then num := ord(p) - 48 else
    if p in ['A'..'Z'] then num := ord(p) - ord('A') + 10
    else continue;
    if num > max then max := num;
    for i := 2 to 36 do
    remain[i] := (remain[i] * i + num) mod (i - 1);
  end;
  for i := max + 1 to 36 do
  if remain[i] = 0 then
  break;
  if remain[i] = 0 then
  writeln(i) else writeln('No solution.');
end.
Re: What's wrong with my program??I got WA many times!!
Posted by XiangGuangTe 21 Apr 2004 14:33
"if p in ['0'..'9'] then num := ord(p) - 48 else"

I think it is
if p in ['0'..'9'] then num := (ord(p) - 48) mod 10 else