#abc274b. B - Line Sensor
B - Line Sensor
Score : points
问题描述
存在一个从上到下有 行、从左到右有 列的网格。令 表示从顶部数起第 行、从左边数起第 列的方格。
方格用字符 描述。若 为 .
,表示 为空;若为 #
,则表示 包含一个箱子。
对于满足 的整数 ,定义整数 如下:
- 是第 列中箱子的数量。换句话说, 是满足 为
#
的整数 的个数。
找出所有的 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There is a grid with rows from top to bottom and columns from left to right. Let denote the square at the -th row from the top and -th column from the left.
The squares are described by characters . If is .
, is empty; if it is #
, contains a box.
For integers satisfying , let the integer defined as follows.
- is the number of boxes in the -th column. In other words, is the number of integers such that is
#
.
Find all of .
Constraints
- and are integers.
- is
.
or#
.
Input
The input is given from Standard Input in the following format:
Output
Print in the following format:
Sample Input 1
3 4
#..#
.#.#
.#.#
Sample Output 1
1 2 0 3
In the -st column, one square, , contains a box. Thus, .
In the -nd column, two squares, and , contain a box. Thus, .
In the -rd column, no squares contain a box. Thus, .
In the -th column, three squares, , , and , contain a box. Thus, .
Therefore, the answer is .
Sample Input 2
3 7
.......
.......
.......
Sample Output 2
0 0 0 0 0 0 0
There may be no square that contains a box.
Sample Input 3
8 3
.#.
###
.#.
.#.
.##
..#
##.
.##
Sample Output 3
2 7 4
Sample Input 4
5 47
.#..#..#####..#...#..#####..#...#...###...#####
.#.#...#.......#.#...#......##..#..#...#..#....
.##....#####....#....#####..#.#.#..#......#####
.#.#...#........#....#......#..##..#...#..#....
.#..#..#####....#....#####..#...#...###...#####
Sample Output 4
0 5 1 2 2 0 0 5 3 3 3 3 0 0 1 1 3 1 1 0 0 5 3 3 3 3 0 0 5 1 1 1 5 0 0 3 2 2 2 2 0 0 5 3 3 3 3
update @ 2024/3/10 11:32:16