比赛 |
20121108 |
评测结果 |
AAAAAAAAAA |
题目名称 |
K 上升段 |
最终得分 |
100 |
用户昵称 |
limitation |
运行时间 |
0.007 s |
代码语言 |
Pascal |
内存使用 |
4.11 MiB |
提交时间 |
2012-11-08 09:17:29 |
显示代码纯文本
program p1258;
uses math;
type arr=array[1..100]of longint;
var n,k,i,j,l:longint;
f:array[1..100,1..100]of arr;
function time(p:arr;o:longint):arr;
var c:arr;
i:longint;
begin
fillchar(c,sizeof(c),0);
for i:=1 to 99 do
begin
c[i]:=c[i]+p[i]*o;
c[i+1]:=c[i] div 10;
c[i]:=c[i] mod 10;
end;
exit(c);
end;
function add(p,o:arr):arr;
var c:arr;
i:longint;
begin
fillchar(c,sizeof(c),0);
for i:=1 to 99 do
begin
c[i]:=c[i]+p[i]+o[i];
c[i+1]:=c[i] div 10;
c[i]:=c[i] mod 10;
end;
exit(c);
end;
begin
assign(input,'k.in');
reset(input);
assign(output,'k.out');
rewrite(output);
read(n,k);
for i:=1 to n do
f[i,1][1]:=1;
for i:=1 to n do
for j:=2 to min(k,i) do
f[i,j]:=add(time(f[i-1,j-1],(i-j+1)),time(f[i-1,j],j));
l:=100;
while (f[n,k][l]=0)and(l>1) do dec(l);
for i:=l downto 1 do
write(f[n,k][i]);
close(input);
close(output);
end.