Brute Force!
题号:NC15883
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

It’s universally acknowledged that there’re innumerable trees in the campus of HUST.
There is an N×M grid, some are black and some are white. You can choose some grids that are black initially, and change the color of these grids and their adjacent grids to white at the same time. You have to figure out the minimum grids you need to choose to change the color of all grids into white.

输入描述:

There are two integers N and M(N+M≤25) in the first line, as described above.
Then there is an N×M grid followed, indicating the color of each grid. ‘#’ denotes black grid and ‘.’denotes white grid.

输出描述:

Output the minimum grids you need to choose.
示例1

输入

复制
3 3
#.#
.#.
#.#

输出

复制
5
示例2

输入

复制
3 3
.#.
###
.#.

输出

复制
1