文件名称:qishiyouli
介绍说明--下载内容均来自于网络,请自行研究使用
任务一的源程序:
const
dx:array[1..4]of integer=(2,2,1,1)
dy:array[1..4]of integer=(1,-1,2,-2)
type
map=record
x,y:integer
end
var
i,j,n,m,k:integer
a:array[0..50,0..50]of map
begin
read(n,m)
fillchar(a,sizeof(a),0)
a[n,m].x:=-1 a[n,m].y:=-1 {标记为终点}
for i:=n downto 2 do {倒推}
for j:=1 to m do
if a[i,j].x<>0 then
for k:=1 to 4 do
begin
a[i-dx[k],j-dy[k]].x:=i
a[i-dx[k],j-dy[k]].y:=j
end
if a[1,1].x=0 then writeln( no )
else begin{存在路径}
i:=1 j:=1
write( ( ,i, , ,j, ) )
while a[i,j].x<>-1 do
begin
k:=i
i:=a[i,j].x j:=a[k,j].y
write( ->( ,i, , ,j, ) )
end
end
end.-One mission of the source code: const dx: array [1 .. 4] of integer = (2,2,1,1) dy: array [1 .. 4] of integer = (1,-1,2,-2 ) type map = record x, y: integer end var i, j, n, m, k: integer a: array [0 .. 50,0 .. 50] of map begin read (n, m) fillchar (a, sizeof (a), 0) a [n, m]. x: =- 1 a [n, m]. y: =- 1 (marking end) for i: = n downto 2 do (backward) for j : = 1 to m do if a [i, j]. x
const
dx:array[1..4]of integer=(2,2,1,1)
dy:array[1..4]of integer=(1,-1,2,-2)
type
map=record
x,y:integer
end
var
i,j,n,m,k:integer
a:array[0..50,0..50]of map
begin
read(n,m)
fillchar(a,sizeof(a),0)
a[n,m].x:=-1 a[n,m].y:=-1 {标记为终点}
for i:=n downto 2 do {倒推}
for j:=1 to m do
if a[i,j].x<>0 then
for k:=1 to 4 do
begin
a[i-dx[k],j-dy[k]].x:=i
a[i-dx[k],j-dy[k]].y:=j
end
if a[1,1].x=0 then writeln( no )
else begin{存在路径}
i:=1 j:=1
write( ( ,i, , ,j, ) )
while a[i,j].x<>-1 do
begin
k:=i
i:=a[i,j].x j:=a[k,j].y
write( ->( ,i, , ,j, ) )
end
end
end.-One mission of the source code: const dx: array [1 .. 4] of integer = (2,2,1,1) dy: array [1 .. 4] of integer = (1,-1,2,-2 ) type map = record x, y: integer end var i, j, n, m, k: integer a: array [0 .. 50,0 .. 50] of map begin read (n, m) fillchar (a, sizeof (a), 0) a [n, m]. x: =- 1 a [n, m]. y: =- 1 (marking end) for i: = n downto 2 do (backward) for j : = 1 to m do if a [i, j]. x
(系统自动生成,下载前可以参看下载内容)
下载文件列表
qishiyouli.txt