hdu 1241(DFS/BFS)】的更多相关文章

Oil Deposits Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 38801    Accepted Submission(s): 22518 Problem Description The GeoSurvComp geologic survey company is responsible for detecting under…
Oil Deposits HDU - 1241 The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides the land into numerous squar…
Problem Description Harry Potter has some precious. For example, his invisible robe, his wand and his owl. When Hogwarts school is in holiday, Harry Potter has to go back to uncle Vernon's home. But he can't bring his precious with him. As you know,…
8个方向求联通块,经典问题. AC代码 #include<cstdio> #include<cstring> #include<algorithm> #include<queue> using namespace std; const int maxn = 100 + 5; const int dx[] = {0,0,-1,1,-1,-1,1,1}; const int dy[] = {1,-1,0,0,1,-1,1,-1}; int n, m; char…
题目链接:  http://acm.hdu.edu.cn/showproblem.php?pid=1241 题目大意:求一张地图里的连通块.注意可以斜着连通. 解题思路: 八个方向dfs一遍,一边dfs一边染色,断了之后换新颜色. 做法类似Tarjan.orz,我是不是刷错顺序了. #include "cstdio" #include "cstring" #include "iostream" #include "string"…
Problem Description 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 save Angel. Their task is: approa…
Oil Deposits Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 31745    Accepted Submission(s): 18440 Problem Description The GeoSurvComp geologic survey company is responsible for detecting under…
HDU 1241 题目大意:给定一块油田,求其连通块的数目.上下左右斜对角相邻的@属于同一个连通块. 解题思路:对每一个@进行dfs遍历并标记访问状态,一次dfs可以访问一个连通块,最后统计数量. /* HDU 1241 Oil Deposits --- 入门DFS */ #include <cstdio> int m, n; //n行m列 ][]; /* 将和i,j同处于一个连通块的字符标记出来 */ void dfs(int i, int j){ || j < || i >=…
HDU 1241  Oil Deposits L -DFS Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64u   Description The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large r…
HDOJ(HDU).1241 Oil Deposits(DFS) [从零开始DFS(5)] 点我挑战题目 从零开始DFS HDOJ.1342 Lotto [从零开始DFS(0)] - DFS思想与框架/双重DFS HDOJ.1010 Tempter of the Bone [从零开始DFS(1)] -DFS四向搜索/奇偶剪枝 HDOJ(HDU).1015 Safecracker [从零开始DFS(2)] -DFS四向搜索变种 HDOJ(HDU).1016 Prime Ring Problem (…