luogu#P3654. First Step (ファーストステップ)

First Step (ファーストステップ)

Background

Everything is full of things I don't know (what should I do?).
Everything is entirely full of unknowns (what should I do?).
Even so, my steps feel light with anticipation (jump!).
But I still have light steps because I’m full of expectation (jump!).
Someday we’ll make this gap in enthusiasm disappear.
That cold attitude will one day disappear without a trace.
I’m fine—I’ll cheer up and keep going.
Show your energy, lift your spirits, and move forward.

We, Aqours, are going to hold our first concert!

Although the student council president doesn’t seem very supportive, with the chairwoman’s backing, we’ve been allowed to sing on the school’s basketball court!

The song is ready, titled “If you really love it, it will be all right! (ダイスキだったらダイジョウブ!)”, and I’m sure everyone will like it!

The concert will definitely go smoothly!

I hope nothing like a power outage happens...!

Problem Description

However... this basketball court seems like it hasn’t been used for a long time.

It’s piled high with all kinds of school odds and ends.

How can the members of Aqours line up inside?

Our basketball court at Uranohoshi Girls’ High School is an RR-by-CC grid. It is filled with various school items (denoted by #), and it looks like there isn’t much open space (denoted by .).

We now have KK members in Aqours. To sing and dance, we need to form a straight line of size 1×K1 \times K, standing one after another on empty cells in the court (either horizontally or vertically).

We want to know how many possible ways there are to stand.

As a true fan of Aqours, can you help us count?

Input Format

The first line contains three integers RR, CC, and KK.

The following RR lines each contain CC characters, representing the basketball court of Uranohoshi Girls’ High School.

Output Format

Output the total number of possible placements.

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

8

Hint

RR CC KK Notes
121\sim2 10\leq 10 min(R,C)\leq \min(R, C) None
343\sim4 100\leq 100 1\leq 1
565\sim6 min(R,C)\leq \min(R, C) No obstacles
7107\sim10 None

For all testdata, 1R,C1001 \leq R, C \leq 100, 1Kmin(R,C)1 \leq K \leq \min(R, C).

Easter egg: In episode 3 of LoveLive! Sunshine!! season 1, when Chika Takami, the leader of Aqours, sings “If you really love it, it will be all right!” up to just before the chorus, the school loses power due to a lightning strike.

Translated by ChatGPT 5