CF1106A Lunar New Year and Cross Counting
题目描述
在一个 $n \times n$ 的地图中寻找有几个图案,满足
$M(i,j)=M(i-1,j-1)=M(i-1,j+1)=M(i+1,j-1)=M(i+1,j+1)=X$
形似下图。
```
X.X
.X.
X.X
```
如果图案中心所在位置不同即视作不同。
输入格式
第一行正整数 $n (1 \le n \le 500)$,表示地图的大小。
接下来 $n$ 行每行 $n$ 个字符,只包含 **'X' 或 '.'**。
输出格式
一行一个整数 $k$ 表示图案个数。
说明/提示
In the first sample, a cross appears at $ (3, 3) $ , so the answer is $ 1 $ .
In the second sample, no crosses appear since $ n < 3 $ , so the answer is $ 0 $ .
In the third sample, crosses appear at $ (3, 2) $ , $ (3, 4) $ , $ (4, 3) $ , $ (4, 5) $ , so the answer is $ 4 $ .