当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1652:Holey Cloth

题目描述
Several pieces of cloth are laid out on the table without overlapping each other. These pieces contain many holes, some so big that entire other piece of cloth may fit into them. Digital black-and-white image of the tabletop was taken, on which areas covered by cloth are represented with '*'s and not covered areas with '.'s. A single piece of cloth is thus represented with 4-connected area of '*'s - i.e., a group of '.'s located next to each other horizontally or vertically, but not diagonally.
.***..***

.*.*.**.*
.***.*.**
*...**.*.
For example, on the image on the left there are three pieces - one without holes, and two with one hole each - first has area of 8, and the second - area of 12.

Your goal is to find the piece with the most holes in it. The hole is a 4-connected area of '.'s completely surrounded with '*'s. If several pieces have the same number of holes, you must select the one with the smallest area.

输入解释
In the first line of input there are two numbers W and H (1 <= W <= 100, 1 <= H <= 100), separated by spaces. Next H lines contain W characters each. Characters in these lines are either '*' (ASCII 42) or '.' (ASCII 46).
输出解释
The output must contain a single integer - the area of the smallest of most holey pieces. If there are no pieces with the holes, the output file must contain zero.
输入样例
9 5
.********
.*......*
.*..**..*
.*......*
.********
输出样例
22

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-1652

最后修改于 2020-10-29T06:10:09+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536