WHY WA on Test 5???
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.