(chr(ord(‘a✀)+b[i]))

2024-12-18 23:24:39
推荐回答(1个)
回答1:

程序错误很多,应该如下修改才可能运行:

var i,j,l,n,k,s,t:integer;
b:array [1..10] of 0..9;
begin
readln(l,n);s:=1; k:=1; t:=1;
while sbegin k:=k+1; t:=t*l; s:=s+t; end;
s:=s-t; n:=n-s-1;
for i:=1 to 10 do b[i]:=0;
j:=11;
while n>0 do
begin j:=j+1; b[j]:=n mod l; n:=n div l; end;
for i:=10-k+1 to 10 do write(chr(ord('a')+b[i]));
end.

正确程序输入:4 123
输出的结果为:aaaaa