P27241 [AtCoder] Refreshment Area
提高-
题目描述

Problem Description

A global programming contest is being held in Japan, and the venue is currently under construction. The venue is divided into a grid of $N$ squares in the north-south direction and $M$ squares in the east-west direction, with some squares containing equipment for the competition.

For the contestants to take a break during the contest, it has been decided to set up a refreshment area within the venue, which will contain light snacks and drinks. The refreshment area must be a continuous block of $D$ squares either in the north-south or east-west direction. However, it cannot be set up on squares that already contain equipment.

Write a program to determine how many ways the refreshment area can be set up within the venue.


Input Format

The input consists of $1 + N$ lines.

The first line contains three integers $N, M, D$ ($1 \leq N \leq 100$, $1 \leq M \leq 100$, $2 \leq D \leq 100$), indicating that the venue is divided into a grid of $N$ squares in the north-south direction and $M$ squares in the east-west direction, and the refreshment area must be a continuous block of $D$ squares.

The following $N$ lines each contain a string of $M$ characters, representing the venue's information. The $i$-th line's $j$-th character ($1 \leq i \leq N$, $1 \leq j \leq M$) is either # or ., where # indicates that the square contains equipment, and . indicates that it does not.

Output Format

Output the number of ways the refreshment area can be set up within the venue on a single line.


Sample Input and Output

Sample Input #1

3 5 2
...#.
#...#
....#

Sample Output #1

12

Sample Input #2

4 7 5
.#.....
.....##
.......
#......

Sample Output #2

7

Notes/Hints

Sample Explanation 1

In the first sample input/output, as shown in the figure below, there are a total of $12$ ways to set up the refreshment area. 2017-yo-t3-fig01.png - - - - - -

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 5 2 ...#. #...# ....#
样例输出
12