#B. 【USTC女生赛校内选拔】骑士

    Type: Default 1000ms 512MiB

【USTC女生赛校内选拔】骑士

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

有一个 8×88 \times 8 的棋盘。棋盘上有的格子是空的(用 . 表示),有的格子是一个马(用 N 表示)。

两个马之间能相互攻击,当且仅当它们的一维坐标之差的绝对值为 11,而另一维坐标的差的绝对值为 22(没有中国象棋中「蹩脚」的限制)。如下图。

image

请你求出棋盘上有多少对马可以互相攻击。

输入格式

八行,每行八个字符,仅包含 .N,其中 . 表示空格,N 表示马。

输出格式

一行一个整数,表示棋盘上有多少对马可以互相攻击。

输入样例

....N.N.
..N.....
.....N..
...N....
........
........
........
NNNNNNNN

输出样例

5

2024 CCPC 女生赛选拔

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
8
Start at
2024-10-13 8:30
End at
2024-10-13 11:30
Duration
3 hour(s)
Host
Partic.
10