CF919C.Seat Arrangements
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.
The classroom contains n rows of seats and there are m seats in each row. Then the classroom can be represented as an n×m matrix. The character '.' represents an empty seat, while '*' means that the seat is occupied. You need to find k consecutive empty seats in the same row or column and arrange those seats for you and your friends. Your task is to find the number of ways to arrange the seats. Two ways are considered different if sets of places that students occupy differs.
假设你身处校园中,需要每天去上课。你可能注意到,当你匆匆赶往教室时,惊讶地发现教室里许多座位已被占用。今天你和朋友们一起去上课,发现其中一些座位已被占用。
教室共有 n 行座位,每行有 m 个座位,因此教室可表示为一个 n×m 的矩阵。字符 '.' 表示空座位,而 '*' 表示该座位已被占用。你需要在同一行或同一列中找到 k 个连续的空座位,并将其安排给你和你的朋友们使用。你的任务是计算安排座位的方法总数。若学生所占座位集合不同,则认为两种安排方式不同。
输入格式
The first line contains three positive integers n,m,k (1≤n,m,k≤2000), where n,m represent the sizes of the classroom and k is the number of consecutive seats you need to find.
Each of the next n lines contains m characters '.' or '*'. They form a matrix representing the classroom, '.' denotes an empty seat, and '*' denotes an occupied seat.
第一行包含三个正整数 n,m,k(1≤n,m,k≤2000),其中 n,m 表示教室的尺寸,k 是你需要找到的连续座位数量。
接下来的 n 行中,每行包含 m 个字符,每个字符为 '.' 或 '*'。它们构成一个表示教室的矩阵,其中 '.' 表示空座位,'*' 表示已被占用的座位。
输出格式
A single number, denoting the number of ways to find k empty seats in the same row or column.
一个整数,表示在同一行或同一列中找到 k 个空座位的方法数。
输入输出样例
输入#1
2 3 2 **. ...
输出#1
3
输入#2
1 2 2 ..
输出#2
1
输入#3
3 3 4 .*. *.* .*.
输出#3
0
说明/提示
In the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement.
- (1,3), (2,3)
- (2,2), (2,3)
- (2,1), (2,2)
在第一个样例中,有三种方式来安排这些座位。您可以选择以下座位进行安排:
- (1,3)、(2,3)
- (2,2)、(2,3)
- (2,1)、(2,2)
输入解题思路,AI测评打分。不知道怎么写?