|
|
back to boardProblem 1104 Posted by Anton 3 Sep 2001 22:23 Why I could not get Accepted?
var Ok:Boolean; C,T,Min,I:LongInt; Ch:Char; begin C:=0; Ok:=False; while not Eof do begin Read(Ch); if Ch in['A'..'Z']then t:=10+Ord(Ch)-Ord('A'); if Ch in['0'..'9']then t:=Ord(Ch)-Ord('0'); if not(Ch in['0'..'9','A'..'Z'])then t:=0; if t>Min then Min:=t; C:=C+t; end; Inc(Min); if C=0 then begin Write(2); Halt(0); end; i:=Min; while(i<=36)and(not Ok)do begin if C mod(i-1)=0 then Ok:=True; Inc(i); end; if Ok then Write(i-1) else Write('No solution.'); end. because yours write out a wrong output ! > Why I could not get Accepted? > > > var > Ok:Boolean; > C,T,Min,I:LongInt; > Ch:Char; > begin > C:=0; > Ok:=False; > while not Eof do begin > Read(Ch); > if Ch in['A'..'Z']then > t:=10+Ord(Ch)-Ord('A'); > if Ch in['0'..'9']then > t:=Ord(Ch)-Ord('0'); > if not(Ch in['0'..'9','A'..'Z'])then > t:=0; > if t>Min then > Min:=t; > C:=C+t; > end; > Inc(Min); > if C=0 then begin > Write(2); > Halt(0); > end; > i:=Min; > while(i<=36)and(not Ok)do begin > if C mod(i-1)=0 then > Ok:=True; > Inc(i); > end; > if Ok then > Write(i-1) > else > Write('No solution.'); > end. |
|
|