http://acm.hdu.edu.cn/showproblem.php?pid=1026
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
/*
bfs ,priority_queue according the step
record the path
*/
using namespace std;
const int N = 100;
char maze[N][N];
int move[][2]={0,1,1,0,0,-1,-1,0},vis[N][N];
int m,n;
struct node
{
int x,y,step;
node (int a=0,int b=0,int c=0)
{
x=a;
y=b;
step=c;
}
};
bool operator<(node a,node b)
{
return a.step>b.step;
}
int bfs()
{
priority_queue<node,vector<node> >que;
node p=node(0,0,0),pp;
que.push(p);
me
本文详细介绍了如何使用广度优先搜索(BFS)解决HDU在线评测系统的1026题,并提供了C语言实现的解题代码和输出路径的解析。
订阅专栏 解锁全文
1139

被折叠的 条评论
为什么被折叠?



