J - Fire!】的更多相关文章

题目传送门 J - Fire! Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help Joe escape the maze. Given Joe’s location in the maze and which squares of the maze are…
题目链接 题意:J代表Joe的位置,F代表火的起点,下一刻火将会向四周扩散,求Joe逃离的最短时间,如果不能逃离输出IMPOSSIBLE; 注意火的起点可能不止一处 可以用两次bfs分别求出人到达某个位置所用时间和火到达某个位置所用时间 #include<iostream> #include<stdio.h> #include<string.h> #define INF 0xfffffff #include<queue> #include<algori…
题目大意: 这是一个放火逃生的游戏,就是给出来一个迷宫,迷宫里面有人‘J’和火焰‘F’当然这些火焰可能不止一处,然后问这个人最快从迷宫里面逃出来需要多久 //////////////////////////////////////////////////////////// 最简单明了的办法就是写两个BFS,这样很容易理解,好吧,那就这么办吧,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 试一下吧. 第一次提交wa,只想到了火焰可能有多处,实际上还有可能没有火焰.…
Description: You are trapped in a building consisting of open spaces and walls. Some places are on fire and you have to run for the exit. Will you make it?At each second, the fire will spread to all open spaces directly connected to the North, South,…
题目描述: Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help Joe escape the maze. Given Joe’s location in the maze and which squares of the maze are on fire…
Joe works in a maze.  Unfortunately, portions of the maze havecaught on  re, and the owner of the maze neglected to create a  reescape plan. Help Joe escape the maze.Given Joe's location in the maze and which squares of the mazeare on  re, you must d…
题意 有一个人 有一些火 人 在每一秒 可以向 上下左右的空地走 火每秒 也会向 上下左右的空地 蔓延 求 人能不能跑出来 如果能 求最小时间 思路 有一个 坑点 火是 可能有 多处 的 样例中 只有一处 然后 先让 火 蔓延 再让人走 BFS AC代码 #include <cstdio> #include <cstring> #include <ctype.h> #include <cstdlib> #include <cmath> #incl…
-->Fire! 直接上中文 Descriptions: 乔在迷宫中工作.不幸的是,迷宫的一部分着火了,迷宫的主人没有制定火灾的逃跑计划.请帮助乔逃离迷宫.根据乔在迷宫中的位置以及迷宫的哪个方块着火,你必须确定火焰烧到他之前,乔是否可以离开迷宫,如果能离开他能跑多快. 乔和火每分钟移动一个方格,上.下.左.右,四个方向中的一个.火势向四个方向同时蔓延.乔可以从迷宫的任何一个边界逃离迷宫.无论是乔还是火都不会到达有墙的位置. 输入 第一行输入包含一个整数,即测试次数 每个测试用例的第一行包含两个…
题目链接:https://vjudge.net/problem/UVA-11624 题意:一个迷宫,可能有一个或者多个地方着火了,每过1个时间消耗,火会向四周蔓延,问Joe能不能逃出迷宫,只要走出迷宫边界就算逃出,火和Joe都不能透过墙. 思路:人和火源分别跑bfs,人一张地图,火源一张地图,跑各自能到达点的时间,火源可能有多个,最后只需要判断迷宫的四个边中人和火源的时间消耗来得出最小答案,出不去输出“IMPOSSIBLE”,思路比较简单,代码稍微复杂点. #include <iostream>…
题目链接 题意:帮助joe走出一个大火蔓延的迷宫,其中joe每分钟可往上下左右四个方向之一走,所有着火的格子都会蔓延(空格与着火格有公共边,下一分钟这个空格也会着火).迷宫中有一些障碍格,joe和火都无法进入,当joe走到一个边界的格子我们认为他走出了迷宫 输出R行C列的迷宫,#表示墙,.表示空地,J表示joe,F是着火格 如果能走出,输出最少时间否则,impossible 分析:不知道怎么处理大火蔓延这个东西,看了书上的方法,太棒了,就是对所以得着火点进行以bfs,就可以求出到蔓延到每一个格子…