比赛 |
2008haoi模拟训练1 |
评测结果 |
AAAAAAAAAA |
题目名称 |
分组 |
最终得分 |
100 |
用户昵称 |
elysian |
运行时间 |
0.004 s |
代码语言 |
Pascal |
内存使用 |
0.21 MiB |
提交时间 |
2008-04-22 11:04:57 |
显示代码纯文本
program cc;
var
nn,xx,count:integer;
i,j,k:integer;
sav:array[0..1000,1..6] of integer;
f1,f2:text;
procedure chazhao(n{rest},x{rest step},a,step:integer);
var
i,j:integer;
begin
for i:=a to (n div x) do
begin
if x>1 then sav[count,step]:=i else sav[count,step]:=n;
if x>1 then chazhao(n-i,x-1,i,step+1)
else begin inc(count);exit;end
end;
end;
begin
assign(f1,'dataa.in');reset(f1);
assign(f2,'dataa.out');rewrite(f2);
readln(f1,nn,xx);
close(f1);
count:=0;
j:=0;
chazhao(nn,xx,1,1);
writeln(f2,count);
for i:=0 to count-1 do
for j:=1 to xx do
begin
if sav[i,j]=0 then sav[i,j]:=sav[i-1,j];
if j<>xx then write(f2,sav[i,j],' ') else writeln(f2,sav[i,j]);
end;
close(f2);
end.