文件名称: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.
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.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
qishiyouli.txt
www.dssz.com.txt
www.dssz.com.txt
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.