记录编号 19661 评测结果 AAAAAAAAAA
题目名称 核电站问题 最终得分 100
用户昵称 GravatarDes. 是否通过 通过
代码语言 Pascal 运行时间 0.000 s
提交时间 2010-10-14 20:04:39 内存使用 0.13 MiB
显示代码纯文本
program nucle;
var a:array[-5..50,0..51]of int64;
    t,k,m,n:longint;
    j:int64;
begin
assign(input,'nucle.in');
reset(input);
assign(output,'nucle.out');
rewrite(output);
readln(n,m);
a[1,0]:=1;
a[1,1]:=1;
a[1,51]:=2;
a[-5,51]:=1;
a[-4,51]:=1;
a[-3,51]:=1;
a[-2,51]:=1;
a[-1,51]:=1;
a[00,51]:=1;
{for t:=2 to n do
  for k:=0 to t do
    begin
      if k=0 then a[t,k]:=1
      else if (t=m)and(k=m) then a[t,k]:=0
      else if k<=m then a[t,k]:=a[t-1,k]+a[t-1,k-1]
      else a[t,k]:=a[t-1,k]+a[t-1,k-1]-a[t-k-1,51];
      a[t,51]:=a[t,51]+a[t,k];
    end;
for t:=0 to n do
  j:=j+a[n,t];
writeln(a[n,51]); }
for t:=2 to n do
  if t<m then
    a[t,51]:=2*a[t-1,51]
  else a[t,51]:=2*a[t-1,51]-a[t-m-1,51];
writeln(a[n,51]);
close(output);
end.