Oil Deposits
Time Limit: 1000MS |
|
Memory Limit: 10000K |
Total Submissions: 6282 |
|
Accepted: 3557 |
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 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
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
0
1
2
2
分享到:
相关推荐
POJ第1861题源码 POJ第1861题源码 POJ第1861题源码
北大POJ水题整合包 解题报告+AC代码
北大 POJ的水题解答C++版,请合理使用
poj部分水题代码描述,为初学者提供一些必要的基础
POJ题目源码 共221题 含源码,题目和简单的分类
POJ水题集-----50道左右-----增加自信啊..
poj 2488——dfs深度优先遍历 //给行数列数,求问能否遍历,给出字典序的一种遍历
poj2009离线题库 poj2009离线题库
poj题目分类打包 acm北大的题库题目分类 来源网络 网络还有自己整理一部分。好久前的玩意了
poj题目,需要可以下载,虽然没有包含所有的题目,但是对初级入门有帮助
poj训练 c语言poj训练 西工大 poj 100题。
我进行挑选的 希望能给你带来方便 也希望你能通过这个有所提高
这是西北工业大学的POJ试题的答案,欢迎下载!
poj水题的部分代码,做的还是比较靠谱的
自动探测POJ、HDU、SOJ、ZOJ水题,对于有志于刷遍各种水题的ACMer来说非常有用
北京大学在线测评网站POJ第1200题的解答,已经AC通过
西工大poj里基本所有的习题了,应该是比较新的习题总集了,1-100.
poj上面的300道AC题,c++源码,自己写的不会有任何问题。
初学acmer必练题,包括图论,动态规划,和数论的基础题