比赛 2008haoi模拟训练1 评测结果 WWEEEEEEWW
题目名称 分组 最终得分 0
用户昵称 WaterFire 运行时间 2.097 s
代码语言 Pascal 内存使用 0.19 MiB
提交时间 2008-04-22 10:48:49
显示代码纯文本
program waterfire;
const
fin='dataa.in';
fout='dataa.out';
type
b=array[1..6] of longint;
var
n,m,i,j,s:longint;
n1,m1:real;
a:b;
f,g:text;
procedure switch(x:b);
var
i,j:longint;
begin

    s:=m-1;
      if (x[s+1]-x[s]=1)or(x[s]=x[s+1])  then
      begin
      dec(s);
    inc(x[s]);
     x[s+1]:=x[s];
      x[s+2]:=n-x[s]-x[s+1];
    end else
    begin
    inc(x[s]);
    dec(x[s+1]);
   end;
   if x[1]+x[2]+x[3]+x[4]+x[5]+x[6]=n then
     for j:= 1 to m-1 do
    write(g,x[j],' ');
    write(g,x[m]);
    writeln(g);

     if (x[s]>=trunc(n/m))and(s=1) then
     begin
     close(g);
     halt;
    end;
    switch(x);
    end;
begin
assign(f,fin);reset(f);
 assign(g,fout);rewrite(g);
read(f,n,m);
close(f);
n1:=n;
m1:=m;
s:=m-1;
  a[m]:=n-m+1;
for i:= 1 to m-1 do
begin
a[i]:=1;

write(g,a[i],' ');
end;
writeln(g,a[m]);
switch(a);
end.