codevs1010
来源:互联网 发布:淘宝买家号权重是什么 编辑:程序博客网 时间:2024/06/07 06:30
题目地址:http://codevs.cn/problem/1010/
分析:
递推
代码:
const c:array[1..8]of integer=(1,1,-1,-1,2,2,-2,-2);d:array[1..8]of integer=(-2,2,-2,2,1,-1,-1,1);
var b:array[-2..21,-2..21]of boolean;
i,j,n,m,x,y:integer; f:array[0..21,0..21]of int64;
begin
readln(n,m,x,y);
fillchar(b,sizeof(b),true);
fillchar(f,sizeof(f),0);
b[x,y]:=false;
for i:=1 to 8 do
b[x+c[i],y+d[i]]:=false;
f[0,0]:=1;
for i:=1 to m do
if not b[0,i] then break else f[0,i]:=f[0,i-1];
for i:=1 to n do
if not b[i,0] then break else f[i,0]:=f[i-1,0];
for i:=1 to n do
for j:=1 to m do
if b[i,j] then
f[i,j]:=f[i-1,j]+f[i,j-1];
writeln(f[n,m]);
end.
0 0
- codevs1010
- codevs1010 过河卒(棋盘dp)
- Codevs1010 过河卒 【简单DP】【细心】
- CodeVS1010 过河卒 解题报告【DP】
- window安装mysql方法图解
- tmux 常用
- 字符串 和 Unicode字符 的互转
- selenium webdriver学习(八)------------如何操作select下拉框
- selenium+webdriver的学习地址
- codevs1010
- CodeForces 474B(Worms)
- hive安装同时以mysql为元数据库
- KDE 4 仿 Plasma 5 主题
- 网络访问框架XUtils
- Linux驱动基础总结
- 【Ray Tracing from Ground Up】光源(Lights)
- mybatis Example Criteria like 模糊查询
- JavaScript和Java的区别