比赛 2008haoi模拟训练1 评测结果 AAAAAWAAAA
题目名称 分组 最终得分 90
用户昵称 NickName 运行时间 0.004 s
代码语言 Pascal 内存使用 0.21 MiB
提交时间 2008-04-22 11:20:35
显示代码纯文本
program datta;
var n,n2,m:integer;
di,ddo:text;
x1,x2:longint;
js:longint;
jiegou:array[1..6] of integer;
jg:array[1..10000] of integer;
t,s:integer;
procedure go(a:integer);
var x:integer;
begin
if n<>0 then

for x:=a to n do
begin
jiegou[t]:=x;
n:=n-x;
if (n>0)and(t<>m) then
begin
t:=t+1;
go(x);
end;
if (t=m) and (n=0) then
begin
js:=js+1;
for x2:=1 to m do
begin
jg[s]:=jiegou[x2];
s:=s+1;
end;
end;
n:=n+x;
end;
t:=t-1;
end;
begin
assign(di,'dataa.in');
reset(di);
read(di,n,m);
close(di);
assign(ddo,'dataa.out');
rewrite(ddo);
t:=1;
js:=0;
s:=1;
go(1);
writeln(ddo,js);
s:=s-1;
for x2:=1 to s do
begin
write(ddo,jg[x2]);
if (x2 mod m=0) and (x2<s) then
writeln(ddo);
if x2 mod m<>0 then
write(ddo,' ');
end;
close(ddo);
end.