![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Bfs学习
文章平均质量分 79
chao887062
面对那么多别人看来是"水题"的题,我只能无奈的一次次WA,顽强的WA着....
展开
-
迷宫寻宝(一)
迷宫寻宝(一)http://acm.nyist.net/JudgeOnline/problem.php?pid=82利用bfs来进行深度搜索,不过我的这个程序写得很烂这是我的:#include"stdio.h"#include"string.h"int v[22][22],q1[409],q2[409],key[6],newx[4]={-1,0,1,0},newy[4]={0,原创 2012-06-29 11:04:03 · 940 阅读 · 0 评论 -
HDOJ 胜利大逃亡
胜利大逃亡 原题连接:http://acm.hdu.edu.cn/showproblem.php?pid=1253思路:利用bfs进行广搜,不过最让人蛋疼的是起点可以是墙,出点也可能为墙,觉得这样出题没什么意思,虽然坑了像我这样的菜鸟。。。自己用c写了一个,不过一直错了将近20多次,后来又自学了stl的队列,一下就过了。。。。利用stl的queue队列写的原创 2012-07-17 18:26:27 · 715 阅读 · 0 评论 -
hdoj Asteroids!
Asteroids!题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1240比较简单的广搜:不过注意一下x,y,z的顺序即可:#include#include#include"cstdio"#include"cstring"using namespace std;char map[11][11][11];int v[11][原创 2012-07-17 18:41:05 · 299 阅读 · 0 评论 -
HDOJ Catch That Cow
Catch That Cow 思路:利用bfs进行广搜,第一个找到的即为最短次数。。。。 题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=2717以下是AC代码:#include"iostream"#include"cstring"#include"cstdio"#include"queue"#define原创 2012-07-17 18:34:25 · 434 阅读 · 0 评论 -
最少步数
最少步数http://acm.nyist.net/JudgeOnline/problem.php?pid=58 思路:广度优先搜索利用队列来实现#include"stdio.h"#include"string.h"int c,d,rear=0,last=0;int q1[82]={0},q2[82]={0},v[9][9],dx[4]={-1,0,1,0},dy[4]={0,-原创 2012-06-14 15:38:10 · 400 阅读 · 0 评论