记录编号 430 评测结果 AAAAAAAAAA
题目名称 分组 最终得分 100
用户昵称 Gravatarrottenwood 是否通过 通过
代码语言 Pascal 运行时间 0.031 s
提交时间 2008-07-18 20:49:24 内存使用 2.02 MiB
显示代码纯文本
program fenzu;
type
shuzu=array[1..1000] of integer;
shuzu1=array[1..1000,1..1000] of integer;
var
i,j,k,m,n,a,b,c:integer;
f1,f2:text;
s:shuzu;
s1:shuzu1;
procedure print(x:integer);
var i,j:integer;
     begin
   inc(c);
   for i:=1 to m-1 do
      s1[c,i]:=s[i];
      s1[c,i+1]:=x;
      end;
procedure try(x,y:integer);
var i,j,k:integer;
    flag:boolean;
  begin
     if (y=m) then print(x)
        else begin
         for j:=s[y-1] to (x div (m-(y-1))) do
              begin
                s[y]:=j;
                 try(x-j,y+1);
                 end;
             end;
             end;
begin
assign(f1,'dataa.in');reset(f1);
assign(f2,'dataa.out');rewrite(f2);
readln(f1,n,m);
c:=0;
for i:=1 to (n div m) do
begin
s[1]:=i;
try(n-i,2);
end;
writeln(f2,c);
for i:=1 to c do
begin
  for j:=1 to m do
       write(f2,s1[i,j],' ');
       writeln(f2);
       end;
       close(f2);
     end.