![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
搜索
dfs和bfs的学习
小白程序猿一枚
专注于后端开发
展开
-
ZOJ - 1649 Rescue(dfs)
Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs, ROADs, and GUARDs in the prison.Angel’s friends want to ...原创 2019-07-31 08:49:48 · 208 阅读 · 0 评论 -
POJ 3050 Hopscotch(dfs暴力)
The cows play the child’s game of hopscotch in a non-traditional way. Instead of a linear set of numbered boxes into which to hop, the cows create a 5x5 rectilinear grid of digits parallel to the x an...原创 2020-02-15 20:25:58 · 212 阅读 · 1 评论 -
POJ 3984-迷宫问题 (dfs)
定义一个二维数组:int maze[5][5] = {0, 1, 0, 0, 0,0, 1, 0, 1, 0,0, 0, 0, 0, 0,0, 1, 1, 1, 0,0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。Input一个5 × 5的二维数组,表示一个迷宫。数据保...原创 2020-02-03 21:45:45 · 186 阅读 · 1 评论 -
POJ 2243 Knight Moves bfs
A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight movesthat visits each square of a given set of n squares on a chessbo...原创 2019-07-27 15:08:54 · 92 阅读 · 0 评论 -
HDU - 1251 统计难题
Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符串.注意:本题...原创 2019-08-11 16:39:55 · 173 阅读 · 0 评论 -
HDU - 1548 A strange lift(dfs)
There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When you at floor i,if...原创 2019-07-28 18:12:37 · 114 阅读 · 0 评论 -
HDU 1010 Tempter of the Bone(dfs+剪枝)
The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone ...原创 2019-08-01 14:28:37 · 310 阅读 · 10 评论 -
HDU - 1016 Prime Ring Problem(dfs)
A ring is compose of n circles as shown in diagram. Put natural number 1, 2, …, n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.Note: the number of fir...原创 2019-07-31 09:08:31 · 89 阅读 · 0 评论