
bfs
文章平均质量分 65
别动我的白羊毛
这个作者很懒,什么都没留下…
展开
-
字节跳动2018校招后端方向(第三批)编程题1
有一个推箱子的游戏, 一开始的情况如下图:上图中, '.' 表示可到达的位置, '#' 表示不可到达的位置,其中 S表示你起始的位置, 0表示初始箱子的位置, E表示预期箱子的位置,你可以走到箱子的上下左右任意一侧, 将箱子向另一侧推动。如下图将箱子向右推动一格;..S0.. -> ...S0.注意不能将箱子推动到'#'上, 也不能将箱子推出边界;现在, 给你游戏的初始...原创 2020-03-14 16:28:07 · 626 阅读 · 0 评论 -
hdu1372 Knight Moves
需要国际象棋的知识,棋盘是1-8,a-h,骑士就是马啦,走的是2*3的格子的对角线,那么就是有八个方位#include#include#include#include#include#include#define N 105using namespace std;struct node{ int x,y,step; };int n,m;int vis[N][原创 2017-09-25 15:52:05 · 207 阅读 · 0 评论 -
hdu2717 Catch That Cow
#include#include#include#include#include#include#define N 100005using namespace std;struct node{ int x,y,step; };int n,m;int vis[N];int k;int check(int x){ if(x100000||vis[x])return原创 2017-09-25 16:16:47 · 158 阅读 · 0 评论 -
hdu 3766 Knight's Trip(并不是bfs)
这题是个骗子,以为和1372是一样的,结果人家数字大的不得了然后就搜了波题解,来自:http://www.cnblogs.com/YY56/p/4954115.html有一种情况我没有怎么看懂,先拉过来吧首先,xy的大小排序和转化为都是正数步数不变应该懂吧。y=2*x这种情况直接就是(x+y)/3步。如果y<2*x但是(x+y)%3==0的话,那么我们可以通过控制(1,原创 2017-09-25 18:02:10 · 656 阅读 · 1 评论 -
hdu1548
#include#include#include#include#include#includeusing namespace std;int s[205];int vis[205];int n,a,b;struct node{ int x;//当前层数 int step;//按的次数 };int bfs(){ queueq; node c,next; c原创 2017-09-11 14:44:27 · 233 阅读 · 0 评论 -
poj 2251 Dungeon Master
题目链接:poj 2251 Dungeon MasterYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute...原创 2018-08-03 17:17:14 · 126 阅读 · 0 评论 -
hdu 2234 无题I (迭代加深)
题目链接:hdu 2234 无题ISample Input21 2 3 41 2 3 41 2 3 42 3 4 14 1 1 11 2 2 22 3 3 33 4 4 4 Sample Output11题意:中文题不说了思路: 第一次做迭代加深的题目,所谓迭代加深,其实就是深搜加上步数,枚举每次要走的步数,依此增加,若当前步数可以使起始状态扩展出...原创 2018-08-03 17:25:59 · 235 阅读 · 0 评论 -
ACM/ICPC 2018亚洲区预选赛北京赛站网络赛 A. Saving Tang Monk II(bfs+dp)
题目链接:hihoCoder #1828 : Saving Tang Monk II时间限制:1000ms单点时限:1000ms内存限制:256MB描述《Journey to the West》(also 《Monkey》) is one of the Four Great Classical Novels of Chinese literature. It was writt...原创 2018-09-25 20:13:52 · 634 阅读 · 0 评论