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

Please help!Why my program is WA?
Posted by majia 9 Aug 2006 09:40
WA 4#.Any one,please,tell me the reason.Thank you!


var a:array[1..10] of integer;
    i,j,k,n,max:longint;
    s,m:int64;
    c:char;
function num(c:char):integer;
begin
if (ord(c)>=48) and (ord(c)<=57) then num:=ord(c)-48;
if (ord(c)>=65) and (ord(c)<=90) then num:=ord(c)-55;
end;
begin
n:=0;max:=0;
while not eof do
begin
while not eoln do
begin
read(c);
inc(n);
a[n]:=num(c);
if a[n]>max then max:=a[n];
end;
readln;
end;
if max<1 then max:=1;
for k:=max+1 to 36 do
begin
s:=0;
for i:=n downto 1 do
 begin
 m:=1;
 for j:=1 to n-i do  m:=m*k;
 s:=s+m*a[i];
 end;
if s mod (k-1) =0 then begin writeln(k); halt; end;
end;
writeln('No solution.');
end.