NxN矩阵棋盘着色问题的符号处理,采用C语言算法编程的实现方式

Problem Description
You are given a chessboard made up of N squares by N squares with equal size. Some of the squares are colored black, and the others are colored white. Please write a program to calculate the number of rectangles which are completely made up of white squares.

Input
There are multiple test cases. Each test case begins with an integer N (1 <= N <= 100), the board size. The following N lines, each with N characters, have only two valid character values:

- (sharp) representing a black square;

. - (point) representing a white square.

Process to the end of file.

Output
For each test case in the input, your program must output the number of white rectangles, as shown in the sample output.

Sample Input
2
.#
..
4
..#.
##.#
.#..
.#.#

Sample Output
5
15

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐