题目: |
program noi_002;
var i,j,l,n,k,s,t:integer; b:array[1..10] of 0..9;
begin
readln(l,n); s:=l; k:=1; t:=l;
if n>l then begin
while s<n do
begin 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]));
readln;
end
else writeln(chr(ord('A')+n-1))
end. 输出:BBAC
|