学长只能帮你到这儿了00-HDU2560
来源:互联网 发布:sql 当前时间减一年 编辑:程序博客网 时间:2024/05/01 16:27
Buildings
Time Limit: 2000/1000 MS(Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1598 Accepted Submission(s): 1357
Problem Description
We divide the HZNUCampus into N*M grids. As you can see from the picture below, the green gridsrepresent the buidings. Given the size of the HZNU Campus, and the color ofeach grid, you should count how many green grids in the N*M grids.
Input
Standard inputwill contain multiple test cases. The first line of the input is a singleinteger T which is the number of test cases. T test cases follow.
The first line of each test case contains two integers n andm(1<=n,m<=100), the size of the campus. Then follow n lines, each linecontaining m integers. The j-th integer in the i-th line is the color of thatgrid, 0 stands for white color, while 1 stands for green.
Output
Results should be directed to standard output. For eachcase, 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
#include<stdio.h>
int main()
{
int t,n,m;
int c,cont;
int i,j;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&n,&m);
cont=0;
for(i=0;i<n;i++)
for(j=0;j<m;j++)
{
scanf("%d",&c);
if(c==1)cont++;
}
printf("%d\n",cont);
}
}
- 学长只能帮你到这儿了00-HDU2560
- 学长只能帮你到这儿了00-HDU1000
- 学长只能帮你到这儿了00-HDU2550
- 学长只能帮你到这儿了00-HDU3188
- 学长只能帮你到这儿了00-HDU1064
- 学长只能帮你到这儿了00-HDU1076
- 学长只能帮你到这儿了01-HDU2000
- 学长只能帮你到这儿了01-HDU2012
- 学长只能帮你到这儿了01-HDU2018
- 学长只能帮你到这儿了01-HDU2026
- 学长只能帮你到这儿了01-HDU2008
- 学长只能帮你到这儿了01-HDU2019
- 学长只能帮你到这儿了01-HDU2032
- 学长只能帮你到这儿了01-HDU2025
- 学长只能帮你到这儿了01-HDU2021
- 学长只能帮你到这儿了01-HDU2042
- 【腾讯潜规则】师兄只能帮你到这了
- 研一上学期各门考试吐槽---师兄只能帮你到这里了
- MFC视图(单文档)的基本用法
- 在xcode4往工程中加入静态库
- 实验用协议软件测试、调试说明(一)
- 学长只能帮你到这儿了00-HDU3188
- Git使用基础篇
- 学长只能帮你到这儿了00-HDU2560
- 缺乏品牌效应 腾讯视频或失利移动
- virtualbox下安装ubuntu8.04 关于 虚拟文件的设置
- Struts2工作原理及流程
- 复制表结构和数据SQL语句
- pthread_attr_setdetachstate
- 关于LINUX shell环境设置命令set 和 shopt
- cocos2d-x中继承CCMenu定义自己的MyMenu,这个是解决优先级的问题
- 学长只能帮你到这儿了00-HDU1064