功能:
- 输入一张地图,找出一条可到达终点的路径,1代表不可走,0代表可走,2代表终点。
效果图:
实现原理:
- DFS遍历。
- 二维数组储存地图。
- -
源代码:
因为输入数据太麻烦,附了组数据。
#include<stdio.h>
typedef struct
{
int x;
int y;
int s;
int f;
}note;
int map[999][999], book[999][999];
note queue[999];
int main()
{
int n, i, j, head, tail, x, y, tx, ty, flag;
int drct[4][2] = {
{
0, 1}, {
0, -1}, {-