HDU2560:Buildings
来源:互联网 发布:边锋游戏大厅mac 编辑:程序博客网 时间:2024/05/22 11:45
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.
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
22 21 10 03 31 0 10 0 11 1 0
Sample Output
25
题目那么长,答案那么水,我都无语了
就是统计方阵里1的个数
#include <iostream>using namespace std;int main(){ int t; cin >> t; while(t--) { int a,b,i,j,f,cnt = 0; cin >> a >> b; for(i = 0;i<a;i++) { for(j = 0;j<b;j++) { cin >> f; if(f) cnt++; } } cout << cnt << endl; } return 0;}
- HDU2560:Buildings
- HDU2560 Buildings【水题】
- Buildings
- Buildings
- Buildings
- Buildings
- Buildings
- Buildings
- Buildings
- Buildings
- Buildings
- Buildings
- Buildings
- HDU2560(计数)
- HDU Buildings
- HDU4296--Buildings
- hdu4296 Buildings
- Buildings 2560
- openCv学习笔记(四)-数学形态学1(二值图像的膨胀、腐蚀、开运算和闭运算)
- ACM Steps_Chapter Five_Section1
- FFMpeg中apiexample.c例子分析——解码分析(转)
- iPhone开发关于UDID和UUID的一些理解
- 模块-模块开发(用户态和内核态通信-通过参数传递数据)
- HDU2560:Buildings
- 嵌入式经典面试题
- Magento如何调用子分类
- linux下安装Oracle10g RAC操作--根据[三思笔记]操作
- ubuntu下jthread 和jrtplib的安装
- 举例分析Linux动态库和静态库
- 关于jsp页面对url特殊字符的处理(加码/解码)2013-5-2
- Prism
- socket编程小记