【问题描述】棋盘上A点有一个过河卒,需要走到目标B点.卒行走的规则:可以向下、或者向右.同时在棋盘上C点有一个对方的马,

问题描述:

【问题描述】
棋盘上A点有一个过河卒,需要走到目标B点.卒行走的规则:可以向下、或者向右.同时在棋盘上C点有一个对方的马,该马所在的点和所有跳跃一步可达的点称为对方马的控制点.因此称之为“马拦过河卒”.
棋盘用坐标表示,A点(0,0)、B点(n,m)(其中:n,m为不超过15的整数),同样马的位置坐标是需要给出的.
任务:现在要求你编写一个程序来计算出卒从A点能够到达B点的路径的条数,假设马的位置是固定不动的,并不是卒走一步马走一步.
【输入格式】
输入文件中仅一行为四个整数,分别表示B点坐标和马的坐标.
【输出格式】
输出文件中仅一行为一个整数,表示所有的路径条数.
【输入输出样例】
输入:
6 6 3 3
输出:
6
要像初学者,增量矩阵、byte类型、comp类型······不能有
要用pascal语言
1个回答 分类:综合 2014-10-09

问题解答:

我来补答
const
dx: array[1 .. 8] of Shortint = (-2, -1, 1, 2, 2, 1, -1, -2);
dy: array[1 .. 8] of Shortint = (1, 2, 2, 1, -1, -2, -2, -1);
var
n, m, x, y, i, j: longint;
g: array[0 .. 20, 0 .. 20] of longint;
f: array[0 .. 20, 0 .. 20] of longint;
begin
Readln(n, m, x, y);
g[x, y] := 1;
for i := 1 to 8 do
if (x + dx[i] >= 0) and (x + dx[i] = 0) and (y + dy[i]
再问: 我是孙嘉祺,和你一起的
再答: 我擦 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你 你你你你你你你
 
 
展开全文阅读
剩余:2000
下一页:数学函数值域