编程介的小学生 2019-06-08 21:52 采纳率: 20.5%
浏览 142

一个网格上面的颜色的选择问题,怎么使用C语言的程序编写的代码技术的方式加以实现的呢

Problem Description
We divide the HZNU Campus into N*M grids. As you can see from the picture below, the green grids represent the buidings. Given the size of the HZNU Campus, and the color of each grid, you should count how many green grids in the N*M grids.

Input
Standard input will contain multiple test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
The first line of each test case contains two integers n and m(1<=n,m<=100), the size of the campus. Then follow n lines, each line containing m integers. The j-th integer in the i-th line is the color of that grid, 0 stands for white color, while 1 stands for green.

Output
Results should be directed to standard output. For each case, output an integers T, the total green grids in the N*M size campus.

Sample Input
2
2 2
1 1
0 0
3 3
1 0 1
0 0 1
1 1 0

Sample Output
2
5

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 汇编语言除法溢出问题
    • ¥65 C++实现删除N个数据列表共有的元素
    • ¥15 Visual Studio问题
    • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
    • ¥20 求一个html代码,有偿
    • ¥100 关于使用MATLAB中copularnd函数的问题
    • ¥20 在虚拟机的pycharm上
    • ¥15 jupyterthemes 设置完毕后没有效果
    • ¥15 matlab图像高斯低通滤波
    • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗