搜索在我们了解了递归之后就可以拿来做一些事♂情♂,比如走迷宫问题,那么这个时候我们就要用到搜索算法。dfs记忆化bfs情况一(找有几条出路):我们平时走迷宫容易见到的策略是:走一条路走到底并放线做标记,如果碰到墙壁就把线收回到上一个路口。这样就引出了dfs的思想:穷尽每一步出现的所有方式,直到找到解为止。模板:void dfs(int n){ if(n>=k){//满足条件或者到底了   
转载 2021-03-16 20:14:50
185阅读
2评论
Cleaning Robot (bfs+dfs) Here, we want to solve path planning for a mobile robot cleaning a rectangular room floor with furniture. Consider the room f
原创 2021-08-03 10:59:01
509阅读
Cleaning Robot (bfs+dfs) Here, we want to solve path planning for a mobile robot cleaning a rectangular room floor with furniture. Consider the room f
原创 2021-08-03 10:59:03
325阅读
Cleaning Robot (bfs+dfs) Here, we want to solve path planning for a mobile robot cleaning a rectangular room floor with furniture. Consider the room f
原创 2021-08-03 10:58:52
218阅读
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1983思路:算得上是暴力解放了。。。orz...由于最多封锁4个区域,因此直接dfs枚举,bfs暴搜即可!!!跑了将近4000ms啊... 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<queue> 5 using namespace std; 6 #define MAXN 10 7 struct Node{ 8 int x,y,time; 9 int ke
转载 2013-05-18 11:21:00
44阅读
2评论
Problem Description Recently kingdom X is suffer a lot from the air strike caused by the enemy, after the air strike, L cities of kingdom X get fired. But because of the lake of the resource of the fi
原创 2023-04-07 10:46:57
31阅读
原创 lightcity 光城 2020-06-271.开篇本节主要阐述BFS+DFS快速完成相关题目,以LeetCode773为例。773. 滑动谜题https://leetcode-cn.com/problems/sliding-puzzle/题目描述:在一个 2 x 3 的板上(board)有 5 块砖瓦,用数字 1~5 来表示, 以及一块空缺用 0 来表示.一次移动定义为选择 0 与一个相
c++
转载 2021-03-16 13:27:15
326阅读
1.开篇本节主要阐述BFS+DFS快速完成相关题目,以LeetCode773为例。773. 滑动谜题https://leetcode-cn.com/problems/sliding-pu...
原创 2021-08-03 09:49:11
93阅读
(先说明,这篇博客记载了一些比较水的,入门的搜索,如果想找高端点的,这篇可能会让各位失望的喔!~待啥时候这篇博客写丰富了再把这句话删了)这个周做了一部分简单搜索题,感觉自己学到了好多,虽然是简单搜索,但是我也是感觉到里边的一些题好难啊,对于搜索,之前看讲解视频的时候,我觉的一句话说的特别对:搜索就是当你处在现在这个状态的时候,下一个状态是什么。下边说说做的题吧:Bfs:1.迷宫问题...
原创
VII
2023-05-29 00:50:53
114阅读
bfs dfs
原创 2021-06-05 10:36:17
221阅读
题意:给你一个迷宫。 先输出当左转优先的时候走的路程长度,再输出当右转优先时走的路程长度,最后输出从起点到终点的最短路程长度。嗯嗯 奴哥活跃气氛的题。随便写了写。。 此题 知道了思路以后就是水题了。。。。 再随便缩缩行也就不到40行 (网上的题解好多200+的。。) 发现p...
转载 2016-05-25 23:43:00
76阅读
2评论
//满基础的一道题 //最短路径肯定是BFS。 //然后靠右,靠左,就DFS啦 //根据前一个状态推出下一个状态,举靠左的例子,如果一开始是上的话,那么他的接下来依次就是 左,上 , 右 , 下 //如果我们用数组存一下 左,上 , 右 , 下, //而且你会发现他原来的状态是...
转载 2016-05-29 13:08:00
33阅读
杭电1044题Collect More Jewels:http://acm.hdu.edu.cn/showproblem.php?pid=1044算法思想:先用bfs建立一张起点、
原创 2022-09-13 15:19:39
104阅读
Collect More JewelsTime Limit: 2000/1000 MS (Java/Others)    Memory Lim
原创 2023-03-02 09:28:16
53阅读
http://poj.org/problem?id=3083 Description The cornfield maze is a popular Halloween treat. Visitors are shown the entrance and must wander through th
原创 2024-08-16 09:35:43
59阅读
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1157 题目描述 小鼠a与小鼠b身处一个m×n的迷宫中,如图
原创 2024-08-16 09:34:44
41阅读
Ignatius and the Princess ITime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12124Accepted Submissio...
原创 2022-03-17 17:43:49
76阅读
Problem Description:It is written in the Book of The Lady: After the Creation, the cruel god Moloch rebelled against the authority of Marduk the Creator.Moloch stole from Marduk the most powerful o...
原创 2023-05-09 10:01:01
30阅读
Kaitou Kid - The Ph
原创 2023-04-23 21:41:08
40阅读
题目链接题解方法一:bfsclass Sol...
转载 2020-07-15 20:46:00
148阅读
2评论
  • 1
  • 2
  • 3
  • 4
  • 5