从一开始拆,往下搜。
var a:array[0..1000] of longint;
n,total:longint;procedure init;
begin
read(n);
end;
procedure print(m:longint);
var i:longint;
begin
inc(total);
write(total,':',n,'=');
for i:=1 to m do
if i<>m then write(a[i],'+') else writeln(a[i]);
end;
procedure try(s,dep:longint);
var i:longint;
begin
if s=0 then
begin
print(dep-1);
exit;
end;
for i:=1 to s do
if(a[dep-1]<=i) then
begin
a[dep]:=i;
s:=s-i;
try(s,dep+1);
s:=s+a[dep];
end;
end;
begin
init;
try(n,1);
end.