POJ 2386 Lake Counting 简单的DFS搜索
来源:互联网 发布:绵阳广电网络 编辑:程序博客网 时间:2024/06/07 03:36
http://poj.org/problem?id=2386
简单DFS搜索
Lake Counting
Time Limit: 1000MS Memory Limit: 65536K
Description
Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water ('W') or dry land ('.'). Farmer John would like to figure out how many ponds have formed in his field. A pond is a connected set of squares with water in them, where a square is considered adjacent to all eight of its neighbors.
Given a diagram of Farmer John's field, determine how many ponds he has.
Given a diagram of Farmer John's field, determine how many ponds he has.
Input
* Line 1: Two space-separated integers: N and M
* Lines 2..N+1: M characters per line representing one row of Farmer John's field. Each character is either 'W' or '.'. The characters do not have spaces between them.
* Lines 2..N+1: M characters per line representing one row of Farmer John's field. Each character is either 'W' or '.'. The characters do not have spaces between them.
Output
* Line 1: The number of ponds in Farmer John's field.
Sample Input
10 12W........WW..WWW.....WWW....WW...WW..........WW..........W....W......W...W.W.....WW.W.W.W.....W..W.W......W...W.......W.
Sample Output
3
- POJ 2386 Lake Counting 简单的DFS搜索
- POJ lake counting(简单的dfs)
- POJ 2386 Lake Counting(简单dfs)
- POJ 2386 Lake Counting(简单的深度搜索)
- POJ 2386 Lake Counting (DFS)
- poj 2386 Lake Counting (DFS~)
- POJ 2386 Lake Counting (dfs)
- POJ Lake Counting 2386(DFS)
- DFS:Lake Counting POJ 2386
- POJ 2386 Lake Counting DFS
- POJ 2386 Lake Counting [DFS]
- POJ 2386 Lake Counting - DFS
- POJ 2386 Lake Counting(DFS)
- POJ - 2386 dfs-Lake Counting
- POJ 2386 Lake Counting (DFS)
- 【DFS】poj 2386 Lake Counting
- POJ 2386 Lake Counting dfs
- 深度搜索DFS-Lake Counting(POJ NO.2386)
- 关于根据指针测定一块内存所占空间大小的问题
- 理解static执行顺序
- How to Overcome Fear, Sadness, Anger and Grief
- asp.net控件开发基础系列
- iis方面的文章
- POJ 2386 Lake Counting 简单的DFS搜索
- Activity、 IEventActivity、 IActivityEventListener
- 电阻的精度和温漂
- HTMLCleaner 的使用心得.
- 在EVC上编译动态库时产生一个 .rel 文件
- 链表与基树(list and radix_tree)实例
- 需求基线管理
- 引用和非引用不能区分函数的重载
- WEB开发之路