
【BFS】
Andy--lee
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
POJ - 3278 - Catch That Cow(bfs+剪枝)
Sample Input 5 17 Sample Output 4 Hint The fastest way for Farmer John to reach the fugitive cow is tomove along the following path: 5-10-9-18-17, which takes 4 minutes. Source::Click her...原创 2018-08-25 10:43:07 · 307 阅读 · 0 评论 -
POJ - 3984 - 迷宫问题(bfs+记录路径)
Sample Input 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 Sample Output (0, 0) (1, 0) (2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (3, 4) (4, 4) 思路 用一个path数组来保存每一步所能走到到的位置进行标号,用于递归输出路径。例如样例中的path数...原创 2018-08-25 15:13:31 · 324 阅读 · 0 评论 -
LightOJ - 1141 - Number Transformation(bfs+质因数分解)
Sample Input 2 6 12 6 13 Sample Output Case 1: 2 Case 2: -1 思路 在这个问题中,给出一个整数s。 您可以通过将x添加到A来将任何整数A转换为另一个整数B.此x是整数,它是A的素数因子(请注意,1和A不被视为A的因子)。 现在,您的任务是找到将s转换为另一个整数t所需的最小转换次数。 注意:将A添加A的质因子(除了1和...原创 2018-08-25 20:10:49 · 331 阅读 · 0 评论 -
HDU - 1372 - Knight Moves(bfs)
Sample Input e2 e4 a1 b2 b2 c3 a1 h8 a1 h7 h8 a1 b1 c3 f6 f6 Sample Output To get from e2 to e4 takes 2 knight moves. To get from a1 to b2 takes 4 knight moves. To get from b2 to c3 takes 2 kn...原创 2018-09-14 17:50:12 · 325 阅读 · 0 评论 -
POJ - 2251 - Dungeon Master(三维bfs)
原创 2018-09-14 20:48:21 · 203 阅读 · 0 评论