Problem 3523 --Lake Counting

3523: Lake Counting

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $4$ 正确数量 $5$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 搜索
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.
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.
Line 1: The number of ponds in Farmer John's field.
10 12
W........WW.
.WWW.....WWW
....WW...WW.
.........WW.
.........W..
..W......W..
.W.W.....WW.
W.W.W.....W.
.W.W......W.
..W.......W.
3

推荐代码 查看3523 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$0 $ms] 梦尘 694279 2020-12-30 21:17:27
内存最少[$0 $KB] aoj_judger 620914 2020-10-14 13:21:25
第一AC aoj_judger 620758 2020-10-13 23:21:46
第一挑战 aoj_judger 620758 2020-10-13 23:21:46

赛题来源/所属竞赛 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛