L - Oil Deposits
#include<queue>
#include<stdio.h>
#include<string.h>
using namespace std; const int maxn = ;
const int oo = 0xfffffff; int dir[][] = { {,},{,-},{,},{-,},
{,-},{,},{-,},{-,-}};
int M, N;
char G[maxn][maxn]; void DFS(int x, int y)
{
if(x<||x==M||y<||y==N||G[x][y] != '@')
return ;
G[x][y] = '*'; for(int i=; i<; i++)
DFS(x+dir[i][], y+dir[i][]);
} int main()
{
while(scanf("%d%d", &M, &N), M+N)
{
int i, j, ans=; for(i=; i<M; i++)
scanf("%s", G[i]); for(i=; i<M; i++)
for(j=; j<N; j++)
{
if(G[i][j] == '@')
{
ans++;
DFS(i, j);
}
} printf("%d\n", ans);
} return ;
}
L - Oil Deposits的更多相关文章
- [kuangbin带你飞]专题一 简单搜索 - L - Oil Deposits
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #i ...
- Oil Deposits -----HDU1241暑假集训-搜索进阶
L - Oil Deposits Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:32768KB ...
- Oil Deposits( hdu1241
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82828#problem/L Oil Deposits Time Limit:1000MS ...
- hdu 1241 Oil Deposits(DFS求连通块)
HDU 1241 Oil Deposits L -DFS Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & ...
- DFS(连通块) HDU 1241 Oil Deposits
题目传送门 /* DFS:油田问题,一道经典的DFS求连通块.当初的难题,现在看上去不过如此啊 */ /************************************************ ...
- Oil Deposits
Oil Deposits Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
- Oil Deposits(dfs)
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission( ...
- 2016HUAS暑假集训训练题 G - Oil Deposits
Description The GeoSurvComp geologic survey company is responsible for detecting underground oil dep ...
- uva 572 oil deposits——yhx
Oil Deposits The GeoSurvComp geologic survey company is responsible for detecting underground oil d ...
随机推荐
- 系统默认字体Mac OS,Windows,XP,Lunix
可查获的信息太少,目前得知的是以中文为例, OS : Helvetical,Lucida Grande(西文默认字体) Windows 7: Microsoft Yahei Xp : Simsun,T ...
- atoi的实现
#include <iostream> using namespace std; int atoi(char* s) { int retval=0; int n=1; if (*s=='- ...
- linux下gdal的python包的安装
由于python包是从C++包编译出来的,所以需要先下载源码进行编译安装.1. gdal下载http://download.osgeo.org/gdal/CURRENT/sudo ./configur ...
- C++实现base64编码(1)
下面的代码是php里面的base64编码逻辑,确实比我之前的要美观很多,我只是简单的用C++的类进行了一下封装,删除了一些没用的逻辑,基本上还是原来PHP的代码: #include <iostr ...
- Nopcommerce架构浅谈之文件结构
应该是在两年前了,在拜读园子里大神的文章时偶然了解到有个叫NopCommerce的商城系统,苦于没有时间,各种耽误,其中研究过一段时间,也就是一个星期时间,后来又耽搁了,直到最近,随着项目进入间歇期, ...
- 【转】app后端如何选择合适的数据库产品
转自:http://blog.csdn.net/newjueqi/article/details/44003503 app后端的开发中,经常要面临的一个问题是:数据放在哪里? mysql ?redis ...
- string.Format 日期格式化
String.Format日期的格式化例子: DateTime dt = DateTime.Now;//2010年10月4日 17点05分 string str = ""; //s ...
- The Child and Sequence
Codeforces Round #250 (Div. 1)D:http://codeforces.com/problemset/problem/438/D 题意:给你一个序列,然后有3种操作 1x ...
- JAVA线程示范之一种
线程有两种方法生成,这是其中的一种.. MyRunnable.java public class MyRunnable implements Runnable { public void run() ...
- Java版将EXCEL表数据导入到数据库中
1.采用第三方控件JXL实现 try { //实例化一个工作簿对象 Workbook workBook=Workbook.getWorkbook(new File("F://qzlx.xls ...