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

WHY WA on Test 5???
Posted by Michael Medvedev 15 Jul 2004 00:01
I tried to read till EOL, till incorect symbol.
What's wrong here?

program p1104;
var
  i,Max,Summa,Number:longint;
  c:char;
  FoundSolution:boolean;
begin
  Summa := 0; Max := 1;
  while True do
  begin
    read(c);
    if c in ['0'..'9'] then Number := Ord(c) - Ord('0') else
    if c in['A'..'Z']  then Number := Ord(c) - Ord('A') + 10
                       else break;
    Summa := Summa + Number;
    if Number > Max then Max := Number;
  end;

  FoundSolution := False;
  for i:=Max to 36 do
    if Summa mod i = 0 then
    begin
      FoundSolution := True;
      break;
    end;
  if FoundSolution then writeln(i+1)
                   else writeln('No Solution.');
end.
Re: WHY WA on Test 5???
Posted by Michael Medvedev 15 Jul 2004 00:11
It seems must be
for i:=Max to 35 do... (but I get also WA on test 5)

Letter Z can't be used in a string, otherwise we'll
get 37 - base system (k=37).
And in a problem we have 2 <= k <= 36
Re: WHY WA on Test 5???
Posted by Night Hawk 25 Feb 2005 19:49
The 's' in 'No solution.' is not a uppercase latin letter.