测试数据 #0: Accepted, time = 0 ms, mem = 812 KiB, score = 10

测试数据 #1: Accepted, time = 0 ms, mem = 812 KiB, score = 10

测试数据 #2: Accepted, time = 0 ms, mem = 812 KiB, score = 10

测试数据 #3: Accepted, time = 0 ms, mem = 816 KiB, score = 10

测试数据 #4: Accepted, time = 0 ms, mem = 812 KiB, score = 10

测试数据 #5: Accepted, time = 0 ms, mem = 812 KiB, score = 10

测试数据 #6: Accepted, time = 0 ms, mem = 812 KiB, score = 10

测试数据 #7: Accepted, time = 0 ms, mem = 816 KiB, score = 10

测试数据 #8: Accepted, time = 0 ms, mem = 812 KiB, score = 10

测试数据 #9: Accepted, time = 0 ms, mem = 812 KiB, score = 10

Accepted, time = 0 ms, mem = 816 KiB, score = 100

//ghz.pas
var
  i,j,a,b,c,d:longint;
  f,fa:array[-2..22,-2..22]of int64;
  
begin
//  assign(input,'ghz.in');
//  assign(output,'ghz.out');
//  reset(input);
//  rewrite(output);
  read(c,d);
  read(a,b);
  fillchar(f,sizeof(f),0);
  fillchar(fa,sizeof(fa),0);
  fa[a,b]:=-1;
  fa[a-2,b-1]:=-1;
  fa[a-2,b+1]:=-1;
  fa[a-1,b-2]:=-1;
  fa[a-1,b+2]:=-1;
  fa[a+1,b-2]:=-1;
  fa[a+1,b+2]:=-1;
  fa[a+2,b-1]:=-1;
  fa[a+2,b+1]:=-1;
  f[0,-1]:=1;
  for i:=0 to c do
    for j:=0 to d do
      if fa[i,j]<>-1 then
        f[i,j]:=f[i-1,j]+f[i,j-1];
  writeln(f[c,d]);
//  close(input);
//  close(output);
end.    

1 条评论

  • 1

信息

ID
1121
难度
4
分类
动态规划 点击显示
标签
递交数
9572
已通过
3779
通过率
39%
被复制
23
上传者