FZU 2150】的更多相关文章

Fire Game Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice FZU 2150 Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning,…
FZU 2150 Fire Game Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u   Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this bo…
FZU 2150 Fire Game(点火游戏) Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description - 题目描述 Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is co…
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82828#problem/I Fire Game Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice FZU 2150 Description Fat brother and Maze are playing a kind of specia…
[题目链接]click here~~ [题目大意]: 两个熊孩子要把一个正方形上的草都给烧掉,他俩同一时候放火烧.烧第一块的时候是不花时间的.每一块着火的都能够在下一秒烧向上下左右四块#代表草地,.代表着不能烧的.问你最少花多少时间能够烧掉.假设烧不掉就输出-1 [解题思路]: 数据比較弱的情况下直接暴力枚举每块草坪上能够放的位置,比較高端的写法眼下没有想到.以后想到了文章更新下~~ ps:因为一个细节没注意,导致WA了差点儿一页,还以为FZU 判题出错了.后来突然发现每次从队列里拿出队首的元素…
称号:fzupid=2150"> 2150 Fire Game :给出一个m*n的图,'#'表示草坪,' . '表示空地,然后能够选择在随意的两个草坪格子点火.火每 1 s会向周围四个格子扩散,问选择那两个点使得燃烧全部的草坪花费时间最小? 分析:这个题目假设考虑技巧的话有点难度,可是鉴于数据范围比較小,我们能够暴力枚举随意的草坪所在的点,然后两个点压进队列里面BFS.去一个满足条件的最小值就可以. 顺便说一下 fzu 2141 Sub-Bipartite Graph 的思路,比赛的时候没…
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2150 Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty a…
http://acm.fzu.edu.cn/problem.php?pid=2150 注意这道题可以任选两个点作为起点,但是时间仍足以穷举两个点的所有可能 #include <cstdio> #include <cstring> #include <queue> using namespace std; const int maxn=11; const int inf=0x3fffffff; char maz[maxn][maxn]; int dp[maxn][maxn…
Problem 2150 Fire Game Accept: 2133    Submit: 7494Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid…
Problem 2150 Fire Game Accept: 3772    Submit: 12868Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each gri…
 Problem 2150 Fire Game Accept: 693    Submit: 2657 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each gri…
枚举两点,然后同步BFS,看代码吧,很容易懂的. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <cstdlib> #include <algorithm> #include <queue> #define Mod 1000000007 using namespace std; struct Po…
点我看题目 题意 :就是有两个熊孩子要把一个正方形上的草都给烧掉,他俩同时放火烧,烧第一块的时候是不花时间的,每一块着火的都可以在下一秒烧向上下左右四块#代表草地,.代表着不能烧的.问你最少花多少时间可以烧掉,如果烧不掉就输出-1 思路 :这个题因为可以同时向上下左右同时烧过去,所以一看我就知道是BFS,但是知道没用啊,我做不出来啊,我一开始没想过来,以为两个人烧很麻烦,其实就是向普通的那样做,不过来个6重for循环就行了,其实就是看看有几个块,如果块的个数超过两个就为-1,两个的话,分别开始烧…
Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start to fire all the grass. Firstl…
题意:两个人玩很变态的游戏,将一个草坪的某两个点点燃,点燃的草坪可以向上下左右四个方向扩散,问能否将整块草坪上面的草都点燃.如果能,输出最短时间(^_^他们就能玩更变态的游戏了),如果不能,输出-1. 思路:先求整个草坪的联通块数量cnt. 1.如果cnt大于2,一定不能点燃全图,输出-1 2.如果cnt等于2,分别在两个联通块枚举每个点中找最短时间,最后答案就是max(time1, time2) 3.如果cnt等于1,此题的关键点.枚举两个点作为bfs的两个起点,注意是两个起点,bfs求在这个…
Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start to fire all the grass. Firstl…
<题目链接> 题目大意: 两个熊孩子在n*m的平地上放火玩,#表示草,两个熊孩子分别选一个#格子点火,火可以向上向下向左向右在有草的格子蔓延,点火的地方时间为0,蔓延至下一格的时间依次加一.求烧完所有的草需要的最少时间.如不能烧完输出-1. 解题分析: 暴力枚举两个起点,然后用BFS求出这两个火源能够蔓延到最远的草地所花的时间,在那些能够烧完所有草地的情况中,选择用时最少的. #include <iostream> #include <cstring> #include…
题意,10*10的地图,有若干块草地“#”,草地可以点燃,并在一秒后点燃相邻的草地.有墙壁‘·‘阻挡.初始可以从任意两点点火.问烧完最短的时间.若烧不完输出-1. 题解:由于100的数据量,直接暴力.枚举两个起点,推入队列,然后bfs.烧完就返回深度,更新一个min值. 坑:(帮同学照bug) return t.step+1;bfs后没有算上最后一步 ac代码 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cs…
Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start to fire all the grass. Firstly they choose two gr…
Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start to fire all the grass. Firstly they c…
题目链接:https://vjudge.net/problem/FZU-2150 题意:’ . '代表火无法烧着的地方,‘ # ’表示草,火可以烧着.选择任意两个‘ # ’(可以两个都选同一个 ‘ # ’),火会蔓延,每过1个时间消耗,向四周蔓延.问:能不能把草全部烧完,可以的话得出最短时间,否则输出 -1. 思路:bfs,枚举所有点火情况就OK了,直接看代码吧. #include <iostream> #include <cstring> #include<vector&g…
题解:一开始想错了,以为只要烧完就是那个答案,但是这不是最优的结果,需要每两个点都bfs一遍,找到如果能够全部烧完,找到花费时间最小的,如果不能return -1.在bfs的时候,记录答案的方法参考了一下其他大神的思路,把能烧到地方都需要能够用个二维数组dis[ ]来标记烧到这个地方时所用的时间是多少.在经过一次两点的bfs后就需要找dis[ ]中最大的那个点,因为这一定是烧完的最后一个点.最后找能烧完的答案中最小的那个就可以了. #include<iostream> #include<…
--> Fire Game 直接写中文了 Descriptions: 两个熊孩子在n*m的平地上放火玩,#表示草,两个熊孩子分别选一个#格子点火,火可以向上向下向左向右在有草的格子蔓延,点火的地方时间为0,蔓延至下一格的时间依次加一.求烧完所有的草需要的最少时间.如不能烧完输出-1. Input 第一行,输入一个T,表示有T组测试数据. 每组数据由一个n,m分别表示行列 1 <= T <=100, 1 <= n <=10, 1 <= m <=10 Output 输…
Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start to fire all the grass. Firstly they c…
题目大意:有一个矩阵,"."表示石头,"#",表示小草,有两个人,可以在任意两个位置点燃小草,小草可以上下左右蔓延,蔓延一次的时间为1,问所有蔓延完所有小草所花费的最短时间.如果不可能蔓延完所有的小草,输出-1. 题解:暴力枚举两个点的位置,然后以这两个点为起点,将这两个点放入队列中,跑bfs.(属于多起点bfs问题) code: #include<cstdio> #include<iostream> #include<cstring&…
        ID Origin Title 454 / 1008 Problem A POJ 1321 棋盘问题   328 / 854 Problem B POJ 2251 Dungeon Master 335 / 1101 Problem C POJ 3278 Catch That Cow   161 / 503 Problem D POJ 3279 Fliptile 247 / 526 Problem E POJ 1426 Find The Multiple 205 / 330 Pro…
KUANGBIN带你飞 全专题整理 https://www.cnblogs.com/slzk/articles/7402292.html 专题一 简单搜索 POJ 1321 棋盘问题    //2019.3.18 POJ 2251 Dungeon Master POJ 3278 Catch That Cow  //4.8 POJ 3279 Fliptile POJ 1426 Find The Multiple  //4.8 POJ 3126 Prime Path POJ 3087 Shuffle…
HDU 1241 Oil Deposits(石油储藏) 00 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)   Problem Description - 题目描述 The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large…
dfs题大杂烩 棋盘问题  POJ - 1321 和经典的八皇后问题一样.  给你一个棋盘,只有#区域可以放棋子,同时同一行和同一列只能有一个棋子. 问你放k个棋子有多少种方案. 很明显,这是搜索题. 因为每一行和每一列只能有一个棋子,所以我们可以从第k行一直到第n行枚举所有放棋子的情况,即我们从当前状态(当前行)dfs到第n行.然后符合添加的,我们就ans++. dfs过程见代码. #include <cstdio> #include <cstring> int n,k,c,wa…
[kuangbin带你飞]专题1-23 专题一 简单搜索 POJ 1321 棋盘问题POJ 2251 Dungeon MasterPOJ 3278 Catch That CowPOJ 3279 FliptilePOJ 1426 Find The MultiplePOJ 3126 Prime PathPOJ 3087 Shuffle'm UpPOJ 3414 PotsFZU 2150 Fire GameUVA 11624 Fire!POJ 3984 迷宫问题HDU 1241 Oil Deposit…