#t312. 流感传染
流感传染
Flu Spread
Problem Background
Special for beginners, ^_^
Problem Description
A group of susceptible people live in a grid-shaped dormitory area, which is an matrix. Each grid point is a room that may be occupied or empty. On the first day, some people in certain rooms catch the flu. Each subsequent day, a person with the flu infects their neighbors (those already sick do not change), while empty rooms are not contagious.
Output the number of people with the flu on day .
Input Format
The first line contains an integer (not exceeding 100), representing an dormitory grid.
The next lines each contain characters: . means the room is occupied by a healthy person on day 1, # means the room is empty, @ means the room is occupied by a person with the flu on day 1.
The following line contains an integer (not exceeding 100).
Output Format
Output the number of people with the flu on day .
Sample Input
5
. . . . #
. # . @ .
. # @ . .
# . . . .
. . . . .
4
Sample Output
16
Constraints
1 second, 1024 KiB for each test case.