比赛 |
2008haoi模拟训练1 |
评测结果 |
AAAAAAAAAA |
题目名称 |
分组 |
最终得分 |
100 |
用户昵称 |
MayLava |
运行时间 |
0.004 s |
代码语言 |
Pascal |
内存使用 |
0.19 MiB |
提交时间 |
2008-04-22 10:42:30 |
显示代码纯文本
program MayLava;
var
m,n,p,i:integer;
stk:array[1..100,1..6]of integer;
procedure start;
var
f:text;
begin
assign(f,'dataa.in');
reset(f);
readln(f,n,m);
close(f);
p:=1;
end;
procedure main(x,y,z:integer);
var
i:integer;
begin
stk[p,y]:=x;
if y=m-1 then begin main(z,y+1,0); exit; end;
if y=m then begin inc(p); stk[p]:=stk[p-1]; exit; end;
for i:=stk[p,y] to (z div (m-y)) do
main(i,y+1,z-i);
end;
procedure print;
var
f:text;
i,j:integer;
begin
assign(f,'dataa.out');
rewrite(f);
writeln(f,p-1);
for i:=1 to p-1 do begin
for j:=1 to m-1 do
write(f,stk[i,j],' ');
writeln(f,stk[i,m]);
end;
close(f);
end;
BEGIN
start;
for i:=1 to (n div m) do
main(i,1,n-i);
print;
END.