📄 ac1268.pas
字号:
program tju1268;
const
maxnodes=18;
var
count:array[0..maxnodes]of longint;
n,i,t:longint;
procedure print(total,n:longint);
var
right:longint;
begin
dec(total);right:=total;
repeat
t:=count[total-right]*count[right];
if n<t then break;
dec(n,t);dec(right);
until false;
if right<total then begin write('(');print(total-right,n div count[right]);write(')');end;
write('X');
if right>0 then begin write('(');print(right,n mod count[right]);write(')');end;
end;
begin
count[0]:=1;
for n:=1 to maxnodes do
for i:=0 to n-1 do
inc(count[n],count[i]*count[n-1-i]);
repeat
read(n);
if n=0 then halt;
i:=0;while n>=count[i] do begin dec(n,count[i]);inc(i);end;
print(i,n);
writeln;
until false;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -