|
|
вернуться в форумHelp with the WA!Thanks Послано Jordan 9 мар 2002 15:11 Const St='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; Var Bit:Longint; P:Array[1..5000] Of Byte; S:String; k,a,b,c,d,e:Longint; Begin Readln(S); Bit:=Length(S); For a:=1 to Bit Do P[a]:=Pos(S[bit+1-a],st)-1; iF s='0' tHEN Begin Writeln('No solution.'); Halt; End; For K:=36 downto 2 Do Begin c:=1;D:=0; For b:=1 to Bit Do Begin D:=D+C*P[b]; c:=C*k; End; If (D Mod (k-1))=0 Then Begin Writeln(K); Halt; End; End; Writeln('No solution.'); End. Input file consists of one string containing no more than 10^6 digits or uppercase latin letters. Послано Lin 9 мар 2002 16:45 > Const St='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; > Var Bit:Longint; > P:Array[1..5000] Of Byte; > S:String; > k,a,b,c,d,e:Longint; > Begin > Readln(S); > Bit:=Length(S); > For a:=1 to Bit Do > P[a]:=Pos(S[bit+1-a],st)-1; > iF s='0' tHEN > Begin > Writeln('No solution.'); > Halt; > End; > For K:=36 downto 2 Do > Begin > c:=1;D:=0; > For b:=1 to Bit Do > Begin > D:=D+C*P[b]; > c:=C*k; > End; > If (D Mod (k-1))=0 Then > Begin > Writeln(K); > Halt; > End; > End; > Writeln('No solution.'); > End. |
|
|