编程介的小学生 2019-03-12 00:34 采纳率: 20.5%
浏览 386

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 全志H618ROM新增分区
    • ¥20 jupyter保存图像功能的实现
    • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
    • ¥15 NAO机器人的录音程序保存问题
    • ¥15 C#读写EXCEL文件,不同编译
    • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
    • ¥15 扩散模型sd.webui使用时报错“Nonetype”
    • ¥15 stm32流水灯+呼吸灯+外部中断按键
    • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
    • ¥15 NX MCD仿真与博途通讯不了啥情况