#P3654. Lineup Formation on the Basketball Court
Lineup Formation on the Basketball Court
Lineup Formation on the Basketball Court
A basketball court of PuZhiXing Girls Academy is represented as an $R\times C$ grid. Some cells contain obstacles (denoted by #
) and some are empty (denoted by .
). The team Aqours has exactly $K$ members, and they want to stand in a contiguous line (of size $1\times K$) on empty cells. The line can be placed either horizontally or vertically on the grid.
Your task is to calculate the number of valid ways to arrange the $K$ team members on empty cells such that they occupy $K$ consecutive positions in a row or a column. Note: When $K=1$, each empty cell counts as one way.
inputFormat
The first line of input contains three integers $R$, $C$, and $K$ ($1 \leq R, C \leq 1000$, $1 \leq K \leq \max(R,C)$). Each of the next $R$ lines contains a string of length $C$, consisting of characters #
and .
, representing the basketball court.
outputFormat
Output a single integer representing the number of valid ways to arrange the team members on the court.
sample
3 3 2
...
.#.
...
8