HDU 1241 油田】的更多相关文章

这道题明明很简单但不知道为什么运行结果一直错,但提交却是对的!代码真是神奇,不过我猜测可能是提上给出的数据错了,可能提上给的数据m和n后多给了一个空格或回车,但题的数据没有 #include<stdio.h> #include<string.h> #define N 110 int m, n; char maps[N][N]; int dir[8][2]={{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {…
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 >=…
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 (…
题目传送门 /* DFS:油田问题,一道经典的DFS求连通块.当初的难题,现在看上去不过如此啊 */ /************************************************ Author :Running_Time Created Time :2015-8-4 10:11:11 File Name :HDOJ_1241.cpp ************************************************/ #include <cstdio> #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…
HDU 1241 是深搜算法的入门题目,递归实现. 原题目传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1241 代码仅供参考,c++实现: #include <iostream> using namespace std; ][]; int p,q; void dfs(int x,int y){ land[x][y] = '*'; ][y]!= ][y] != ] != ] != ][y+]!= ][y-] != ][y-] != ][y+] !…
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…
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…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1241 题意: 求某块平面上,连通块的数量.一个油田格子若周围八个方向也有一个油田格子,则认为两者相连通. AC代码: #include<bits/stdc++.h> using namespace std; typedef pair<int,int> pii; ; ]={,,,-,,,-,-}; ]={,,-,,,-,,-}; int m,n; char mp[maxn][maxn];…
题目链接:  http://acm.hdu.edu.cn/showproblem.php?pid=1241 题目大意:求一张地图里的连通块.注意可以斜着连通. 解题思路: 八个方向dfs一遍,一边dfs一边染色,断了之后换新颜色. 做法类似Tarjan.orz,我是不是刷错顺序了. #include "cstdio" #include "cstring" #include "iostream" #include "string"…