
BFS(广度搜索)
cugzyc
Coding && Reading.
展开
-
A - Rescue【BFS】
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 to...原创 2018-07-31 16:31:16 · 231 阅读 · 0 评论 -
POJ 2312 B - Battle City【BFS】
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 we are discussing is a simple edition of this game. Given a map t...原创 2018-07-31 21:38:28 · 166 阅读 · 0 评论 -
POJ 3278C - Catch That Cow【BFS】
农夫知道一头牛的位置,想要抓住它。农夫和牛都于数轴上 ,农夫起始位于点 N(0<=N<=100000) ,牛位于点 K(0<=K<=100000) 。农夫有两种移动方式: 1、从 X移动到 X-1或X+1 ,每次移动花费一分钟 2、从 X移动到 2*X ,每次移动花费一分钟 假设牛没有意识到农夫的行动,站在原地不。最少要花多少时间才能抓住牛?Input一行: 以空格...原创 2018-08-01 19:25:34 · 168 阅读 · 0 评论 -
D - Dungeon Master【BFS】
Description - 题目描述[NWUACM] 你被困在一个三维的空间中,现在要寻找最短路径逃生!空间由立方体单位构成你每次向上下前后左右移动一个单位需要一分钟你不能对角线移动并且四周封闭是否存在逃出生天的可能性?如果存在,则需要多少时间?Input - 输入 输入第一行是一个数表示空间的数量。 每个空间的描述的第一行为L,R和C(皆不超过30)。 L表示空间...原创 2018-08-02 09:27:24 · 151 阅读 · 0 评论 -
HDU - 2266 D - How Many Equations Can You Find 【DFS】
How Many Equations Can You FindTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 641 Accepted Submission(s): 421Problem DescriptionNow g...原创 2018-08-08 15:33:47 · 170 阅读 · 0 评论 -
POJ - 3984 迷宫问题【BFS+路径记录】
定义一个二维数组: 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一个5 ×...原创 2018-08-08 16:07:11 · 218 阅读 · 0 评论