称号:fzupid=2150"> 2150 Fire Game :给出一个m*n的图,'#'表示草坪,' . '表示空地,然后能够选择在随意的两个草坪格子点火.火每 1 s会向周围四个格子扩散,问选择那两个点使得燃烧全部的草坪花费时间最小? 分析:这个题目假设考虑技巧的话有点难度,可是鉴于数据范围比較小,我们能够暴力枚举随意的草坪所在的点,然后两个点压进队列里面BFS.去一个满足条件的最小值就可以. 顺便说一下 fzu 2141 Sub-Bipartite Graph 的思路,比赛的时候没…
[题目链接]click here~~ [题目大意]: 两个熊孩子要把一个正方形上的草都给烧掉,他俩同一时候放火烧.烧第一块的时候是不花时间的.每一块着火的都能够在下一秒烧向上下左右四块#代表草地,.代表着不能烧的.问你最少花多少时间能够烧掉.假设烧不掉就输出-1 [解题思路]: 数据比較弱的情况下直接暴力枚举每块草坪上能够放的位置,比較高端的写法眼下没有想到.以后想到了文章更新下~~ ps:因为一个细节没注意,导致WA了差点儿一页,还以为FZU 判题出错了.后来突然发现每次从队列里拿出队首的元素…
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…
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.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…
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…
<题目链接> 题目大意: 两个熊孩子在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…
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,…
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…
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…
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 思路 :这个题因为可以同时向上下左右同时烧过去,所以一看我就知道是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…
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…
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…
枚举两点,然后同步BFS,看代码吧,很容易懂的. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <cstdlib> #include <algorithm> #include <queue> #define Mod 1000000007 using namespace std; struct Po…
package zhongqiuzuoye; //自己写的方法 public class Rect { public double width; public double height; Rect(double width,double height) //带有两个参数的构造方法,用于将width和height属性初化; { this.width=width; this.height=height; } Rect() //不带参数的构造方法,将矩形初始化为宽和高都为10. { width=10…
#include<cstdio> #include<queue> using namespace std; struct sss { int x,y; }ans[][]; ][]; ][]; ][]={,,,,-,,,-}; void print(struct sss q) { &&q.y==) { printf("(0, 0)\n"); return; } else { print(ans[q.x][q.y]); printf("(%…
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…
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…
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…
Problem 2150 Fire Game Accept: 145    Submit: 542 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 o…
 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…
题意:两个人玩很变态的游戏,将一个草坪的某两个点点燃,点燃的草坪可以向上下左右四个方向扩散,问能否将整块草坪上面的草都点燃.如果能,输出最短时间(^_^他们就能玩更变态的游戏了),如果不能,输出-1. 思路:先求整个草坪的联通块数量cnt. 1.如果cnt大于2,一定不能点燃全图,输出-1 2.如果cnt等于2,分别在两个联通块枚举每个点中找最短时间,最后答案就是max(time1, time2) 3.如果cnt等于1,此题的关键点.枚举两个点作为bfs的两个起点,注意是两个起点,bfs求在这个…
                                                                                                                                          Problem 2150 Fire Game Accept: 2185    Submit: 7670Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Desc…
# ### 自动类型转换(针对于Number数据类型来的) ''' 精度从低到高 bool->int-> float->complex 当两个不同是数据类型运算时候,默认想更高进度转化 ''' # True 转化成整型是1 False转化成整型是0 # bool + int res = True + 1 print(res) #boll + float res = True +4.14 print(res) #bool+complex res = False + 3j print(res…
对于进行广度优先搜索的队列中,应该始终满足两个性质:   性质1:若队首为第i层拓展到的节点,则队列中最多只能存在第i层和第i+1层的节点,不可能出现3层节点.   性质2:队列中的元素会严格按照层数单调递增,而且会按照入队的先后来判别拓展的优先程度,即先入队的一定是更优先的,而越往后越次之.   通过这两个性质,其实我们就可以更严格更方便更快捷更明确地设计有关BFS的程序,当已经找到一个目标节点,即可以终止程序(or过程). 而对于单调性的优化,则可以使用单调队列.双端队列.优先队列代替普通队…
原文链接:http://highscalability.com/blog/2013/7/8/the-architecture-twitter-uses-to-deal-with-150m-active-users.html 写于2013年7月8日,译文如下: “可以解决推特所面临的挑战”的玩具般的方案是一个常用在扩展性上的比喻.每个人都觉得推特很容易实现.稍微具备一些系统架构的知识我们就可以构建一个推特,就这么简单.但是根据推特软件开发部门的VP Raffi Krikorian在 Timelin…