#abc275c. C - Counting Squares
C - Counting Squares
Score : points
问题陈述
在二维平面上,对于整数 和 在 到 之间,若 的第 个字符为 #
,则坐标 处有一个棋子;若第 个字符为 .
,则该位置没有棋子。
求在这个平面上有多少个正方形的四个顶点上都放置了棋子。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There is a two-dimensional plane. For integers and between and , there is a pawn at the coordinates if the -th character of is #
, and nothing if the -th character of is .
.
Find the number of squares in this plane with pawns placed at all four vertices.
Constraints
- Each of is a string of length consisting of
#
and.
.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
##.......
##.......
.........
.......#.
.....#...
........#
......#..
.........
.........
Sample Output 1
2
The square with vertices , , , and have pawns placed at all four vertices.
The square with vertices , , , and also have pawns placed at all four vertices.
Thus, the answer is .
Sample Input 2
.#.......
#.#......
.#.......
.........
....#.#.#
.........
....#.#.#
........#
.........
Sample Output 2
3
update @ 2024/3/10 11:34:45