hdu 1241 简单 搜索DFS (深搜)
来源:互联网 发布:淘宝面单打印软件 编辑:程序博客网 时间:2024/06/05 15:10
Oil Deposits
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 22567 Accepted Submission(s): 12989
Problem Description
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 square plots. It then analyzes each plot separately, using sensing equipment to determine whether or not the plot contains oil. A plot containing oil is called a pocket. If two pockets are adjacent, then they are part of the same oil deposit. Oil deposits can be quite large and may contain numerous pockets. Your job is to determine how many different oil deposits are contained in a grid.
Input
The input file contains one or more grids. Each grid begins with a line containing m and n, the number of rows and columns in the grid, separated by a single space. If m = 0 it signals the end of the input; otherwise 1 <= m <= 100 and 1 <= n <= 100. Following this are m lines of n characters each (not counting the end-of-line characters). Each character corresponds to one plot, and is either `*', representing the absence of oil, or `@', representing an oil pocket.
Output
For each grid, output the number of distinct oil deposits. Two different pockets are part of the same oil deposit if they are adjacent horizontally, vertically, or diagonally. An oil deposit will not contain more than 100 pockets.
Sample Input
1 1*3 5*@*@***@***@*@*1 8@@****@*5 5 ****@*@@*@*@**@@@@*@@@**@0 0
Sample Output
0122
Source
Mid-Central USA 1997
0 0
- hdu 1241 简单 搜索DFS (深搜)
- 搜索--HDU简单DFS
- HDU 1241(搜索题,DFS)
- HDU 1241Oil Deposits(dfs搜索)
- hdu 1181 变形课 (dfs)简单搜索
- hdu 1241 简单dfs
- HDU--1241 简单DFS
- hdu 5424(dfs搜索)
- 寒假前刷题(8)搜索系列 dfs hdu 1241
- hdu 1181 (搜索BFS,深搜DFS,并查集)
- HDU 1241 简单的DFS
- HDU-5546(简单DFS)
- HDU 1181 变形课 深度优先搜索(DFS)简单题
- HDU 1312Red and Black(简单搜索 bfs或dfs)
- HDU 1312(搜索题,DFS)
- HDU 1010(搜索题,DFS+剪枝)
- HDU 1016(搜索题,DFS)
- HDU 1072 Nightmare(搜索-DFS)
- 如何学习算法
- 开发工具:GitHub的使用
- C++委托实现(函数指针,function+bind,委托模式)
- Python3 nonlocal
- windows 8关闭小键盘
- hdu 1241 简单 搜索DFS (深搜)
- bzoj 1411: [ZJOI2009]硬币游戏 找规律
- LeetCode------Contains Duplicate
- tabLayout 和Viewpager 实现滑动
- 对于静态和非静态类的属性的理解
- Linux--图形界面与文本界面的切换
- shell下的单引号与双引号
- Zookeeper -- 管理分布式环境中的数据
- android获取周围WIFI热点