记录编号 |
3565 |
评测结果 |
AAAAAAAAAA |
题目名称 |
分组 |
最终得分 |
100 |
用户昵称 |
WaterFire |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.045 s |
提交时间 |
2008-10-08 16:05:12 |
内存使用 |
0.20 MiB |
显示代码纯文本
program waterfire;
const
fin='dataa.in';
fout='dataa.out';
var
ans,i,j,n,s,m:longint;
data:array[0..2000,0..10] of longint;
f,g:text;
dd:array[0..10] of longint;
Procedure search(x:longint);
var
ii,jj:longint;
begin
if dd[1]>(n div m) then
begin
writeln(g,s);
for i:=1 to s do begin
for j:=1 to m-1 do
write(g,data[i,j],' ');
writeln(g,data[i,m]);
end;
close(g);
halt;
end;
if x=m then begin
if n-ans>=dd[x-1] then
begin
inc(s);
dd[x]:=n-ans;
for ii:=1 to m do
data[s,ii]:=dd[ii];
end;
end else
for jj:=1 to n do
if jj>=dd[x-1] then
begin
dd[x]:=jj;
inc(ans,jj);
inc(x);
search(x);
dec(x);
dec(ans,jj);
end;
end;
Begin
s:=0;
assign(f,fin);reset(f);
assign(g,fout);rewrite(g);
read(f,n,m);close(f);
search(1);
end.