2017ICPC南宁赛区网络赛 Minimum Distance in a Star Graph (bfs)
摘要:In this problem, we will define a graph called star graph, and the question is to find the minimum distance between two given nodes in the star graph.
阅读全文
poj 2251 Dungeon Master (BFS 三维)
摘要:You 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.
阅读全文
什么时候用深搜(dfs)什么时候用广搜(bfs)(转)
摘要:1.BFS是用来搜索最短径路的解是比较合适的,比如求最少步数的解,最少交换次数的解,因为BFS搜索过程中遇到的解一定是离根最近的,所以遇到一个解,一定就是最优解,此时搜索算法可以终止。这个时候不适宜使用DFS,因为DFS搜索到的解不一定是离根最近的,只有全局搜索完毕,才能从所有解中找出离根的最近的解
阅读全文
POJ 3278 Catch That Cow (bfs)
摘要:Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a numb
阅读全文
POJ 3414 Pots(BFS)
摘要:Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Description You are given two pots, having the volume of A and B liters respectivel
阅读全文
HDU 1728 逃离迷宫
摘要:Problem Description 给定一个m × n (m行, n列)的迷宫,迷宫中有两个位置,gloria想从迷宫的一个位置走到另外一个位置,当然迷宫中有些地方是空地,gloria可以穿越,有些地方是障碍,她必须绕行,从迷宫的一个位置,只能走到与它相邻的4个位置中,当然在行走过程中,glor
阅读全文
HDU 2102 A计划
摘要:Problem Description 可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的骑士LJ肯
阅读全文
HDU 1548 A strange lift(BFS)
摘要:Problem Description 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.Th
阅读全文
HDU 1254 推箱子(BFS)
摘要:Problem Description 推箱子是一个很经典的游戏.今天我们来玩一个简单版本.在一个M*N的房间里有一个箱子和一个搬运工,搬运工的工作就是把箱子推到指定的位置,注意,搬运工只能推箱子而不能拉箱子,因此如果箱子被推到一个角上(如图2)那么箱子就不能再被移动了,如果箱子被推到一面墙上,那么
阅读全文