
BFS
风之旅@
努力到一定的程度,幸运就会与你不期而遇
展开
-
A - Rescue(广度优先搜索BFS)
A - Rescue 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 f...原创 2018-07-31 20:47:50 · 239 阅读 · 0 评论 -
POJ - 3984 迷宫问题
定义一个二维数组: 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...原创 2018-12-03 21:49:16 · 177 阅读 · 0 评论 -
HDU - 1242 Rescue
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 t...原创 2018-12-07 12:57:11 · 146 阅读 · 0 评论 -
POJ - 2312 Battle City
Many of us had played the game "Battle city" in our childhood, and some people (like me) even often play it on computer now. What ...原创 2018-12-10 10:24:07 · 147 阅读 · 0 评论 -
POJ - 3278 Catch That Cow
农夫知道一头牛的位置,想要抓住它。农夫和牛都于数轴上 ,农夫起始位于点 N(0<=N<=100000) ,牛位于点 K(0<=K<=100000) 。农夫有两种移动方式: 1、从 X移动到 X-1或X+1 ,每次移动花费一分钟 2、从 X移动到 2*X ,每次移动花费一分钟 假设牛没有意识到农夫的行动,站在原地不。最少要花多少时间才能抓住牛? Input一...原创 2018-12-10 10:36:22 · 122 阅读 · 0 评论 -
POJ - 2251 Dungeon Master
Description - 题目描述[NWUACM] 你被困在一个三维的空间中,现在要寻找最短路径逃生!空间由立方体单位构成你每次向上下前后左右移动一个单位需要一分钟你不能对角线移动并且四周封闭是否存在逃出生天的可能性?如果存在,则需要多少时间? Input - 输入 输入第一行是一个数表示空间的数量。 每个空间的描述的第一行为L,R和C(皆不超过30)。 ...原创 2018-12-10 20:07:20 · 214 阅读 · 0 评论 -
POJ - 1573 Robot Motion
A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down ...原创 2018-12-10 21:46:45 · 153 阅读 · 0 评论 -
LightOJ - 1141 Number Transformation
In this problem, you are given an integer number s. You can transform any integer number A to another integer number B by adding x to A. This x is an integer number which is a prime factor of A (plea...原创 2018-12-11 22:05:00 · 177 阅读 · 0 评论 -
HDU - 1372 Knight Moves
A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n squares on a chessbo...原创 2018-12-12 13:23:11 · 132 阅读 · 0 评论