《(完整word版)实验报告——迷宫问题.pdf》由会员分享,可在线阅读,更多相关《(完整word版)实验报告——迷宫问题.pdf(7页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、实习 2 栈的应用本次实习的主要目的在于帮助学生深入了解栈的特性,以便在实际问题背景下灵活运用他们;同时还将巩固对栈这种结构的构造方法的理解。实验课时6 课时程序 1:迷宫问题问题描述以一个 mn 的长方阵表示迷宫,0和 1分别表示迷宫中的通路和障碍。设计一个程序,对任意设定的迷宫,求出一条从入口到出口的通路,或得出没有通路的结论。基本要求首先实现一个以顺序表或链表做存储结构的栈类型,然后编写一个求解迷宫的非递归程序。求得的通路以三元组(i,j,d)的形式输出,其中:(i,j)指示迷宫中的一个坐标,d表示走到下一坐标的方向。如:对下列数据的迷宫,输出的一条通路为:(1,1,1),(1,2,2)
2、,(2,2,2),测试数据迷宫的测试数据如下:左上角(1,1)为入口,右下角(3,4)为出口。实现提示 计算机解迷宫通常用的是“穷举求解”方法,即从入口出发,顺着某一个方向进行探索,若能走通,则继续往前进;否则沿原路退回,换一个方向再继续探索,直至所有可能的通路都探索到为止,如果所有可能的通路都试探过,还是不能走到终点,那就说明该迷宫不存在从起点到终点的通道,可以二维数组存储迷宫数据。程序实现#include#include /1.迷宫位置坐标类型typedef struct int x;/行int y;/列PosType;#define MAXENGTH 25/迷宫最大行列数位25 type
3、def int MazeTypeMAXENGTHMAXENGTH;/迷宫数列11111111111111111111110000000!012345typedef struct/定义栈 int ord;/通道块在路径上的序号PosType seat;/通道块在迷宫中的位置int di;/走向下一块的方向(03 表示东、南、西、北)SElemType;/2.全局变量MazeType m;/迷宫数组int curstep=1;/当前位置,初值为1#define STACK_INIT_SIZE 10/存储空间初始分配量#define STACKINCREMENT 2/存储空间分配增量/3.栈的顺序存
4、储表示typedef struct SqStack SElemType*base;/尾指针SElemType*top;/头指针int stacksize;/栈大小SqStack;/顺序表/4.构造空栈int InitStack(SqStack&S)S.base=(SElemType*)malloc(STACK_INIT_SIZE*sizeof(SElemType);if(!(S.base)exit(0);S.top=S.base;S.stacksize=STACK_INIT_SIZE;return 1;/5.判断栈是否为空(用来判断迷宫是否不可达到出口)int StackEmpty(SqSta
5、ck S)if(S.top=S.base)/栈底与栈顶相等为空栈return 1;else return 0;/6.插入元素int Push(SqStack&S,SElemType e)文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档
6、编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O
7、7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1
8、 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10
9、文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M
10、5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4
11、P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10if(S.top-S.base=S.stacksize)/栈顶-栈底=栈长,说
12、明空间已满 S.base=(SElemType*)realloc(S.base,(S.stacksize+STACKINCREMENT)*sizeof(SElemType);if(!S.base)exit(0);S.top=S.base+S.stacksize;S.stacksize+=STACKINCREMENT;*(S.top)+=e;return 1;/7.栈不为空时,删除栈顶元素,用e 返回(用于当栈顶元素各方向均不通时,将其从路径中删除)int Pop(SqStack&S,SElemType&e)if(S.top=S.base)return 0;e=*-S.top;/先将 S.top
13、 的值赋给e,再将 S.top 向下移一位return 1;/8.判断迷宫m 中 b 点是否可通过(是1,否 0),其中墙为0,可通过路径为1,不可通过路径为-1 int Pass(PosType b)if(mb.xb.y=1)return 1;else return 0;/9.是迷宫 m 中 a 的序号变为足迹(即该位置目前可通过)void FootPrint(PosType a)ma.xa.y=curstep;/10.根据当前位置方向,返回下一位置PosType NextPos(PosType c,int di)PosType direc4=0,1,1,0,0,-1,-1,0;c.x+=d
14、irecdi.x;文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码
15、:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7
16、HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 Z
17、Y7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档
18、编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O
19、7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1
20、 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10c.y+=direcdi.y;return c;/11.道路不能通过时(即为死路),将其标记为-1 void MarkPrint(PosType b)mb.xb.y=-1;/12.求迷宫出口int MazePath(PosType start,P
21、osType end)SqStack S;PosType curpos;/当前位置SElemType e;InitStack(S);curpos=start;do if(Pass(curpos)FootPrint(curpos);e.ord=curstep;e.seat.x=curpos.x;e.seat.y=curpos.y;e.di=0;Push(S,e);curstep+;if(curpos.x=end.x&curpos.y=end.y)return 1;curpos=NextPos(curpos,e.di);else if(!StackEmpty(S)Pop(S,e);curstep-
22、;while(e.di=3&!StackEmpty(S)MarkPrint(e.seat);Pop(S,e);文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V1
23、0文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5
24、M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z
25、4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8
26、V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1
27、H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H
28、4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10curstep-;if(e.di3)e.di+;Push(S,e);curstep+;curpos=NextPos(e.seat,e.di);while(
29、!StackEmpty(S);return 0;/13.输出迷宫结构void Print(int x,int y)int i,j;for(i=0;ix;i+)for(j=0;jy;j+)printf(%3d,mij);printf(n);/14.主函数int main()PosType begin,end;int i,j,x,y,x1,y1;printf(请输入迷宫行列数(包括外墙):(空格隔开)n);scanf(%d%d,&x,&y);for(i=0;ix;i+)/定义外墙 m0i=0;mx-1i=0;for(j=0;jy-1;j+)mj0=0;mjy-1=0;文档编码:CG8Q1H5M5O
30、7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1
31、 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10
32、文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M
33、5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4
34、P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V
35、10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H
36、5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10for(i=1;ix-1;i+)for(j=1;jy-1;j+)mij=1;/墙内初始值均为1/输入迷宫中墙的个数printf(输入墙的个数:);scanf(%d,&j);/安排墙的位置printf(请输入墙的位置(坐标),用空格隔开:n);for(i=1;i=j;i+)scanf(%d%d,
37、&x1,&y1);mx1y1=0;printf(迷宫结构如下n);Print(x,y);printf(请输入起点坐标:n);scanf(%d%d,&begin.x,&begin.y);printf(请输入终点坐标:n);scanf(%d%d,&end.x,&end.y);if(MazePath(begin,end)printf(此迷宫的一条路径如下:n);Print(x,y);else printf(此迷宫无法到达出口n);return 0;实验结果 文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY
38、7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编
39、码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7
40、 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1
41、ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文
42、档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5
43、O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P
44、1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V1
45、0文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5
46、M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z
47、4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8
48、V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1
49、H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10文档编码:CG8Q1H5M5O7 HC1V1H4Z4P1 ZY7R1B9I8V10