ac1268.pas
来自「这是在网络上搜集到的在东京大学的ACM上面解决的一些题目的源码」· PAS 代码 · 共 36 行
PAS
36 行
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 + =
减小字号Ctrl + -
显示快捷键?