首页 > 其他分享 >杭电ACM HDU 2560 Buildings

杭电ACM HDU 2560 Buildings

时间:2023-08-21 12:37:59浏览次数:45  
标签:HDU grids 2560 each 杭电 green HZNU test cases


Buildings

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1828    Accepted Submission(s): 1553


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.




杭电ACM HDU 2560 Buildings_c++



 


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



 


Source


2008 HZNU Programming Contest



 


Recommend


lcy


 

刷水题

#include<cstdio>
int main(){
    int t,n,m,i,c,p;
    for(scanf("%d",&t);t--;printf("%d\n",c))
        for(scanf("%d%d",&n,&m),c=i=0;i<n*m;i++,!p?:c++)
            scanf("%d",&p);
}

 

标签:HDU,grids,2560,each,杭电,green,HZNU,test,cases
From: https://blog.51cto.com/u_10101161/7173512

相关文章

  • 杭电ACM HDOJ 1039 Easier Done Than Said?
    EasierDoneThanSaid?TimeLimit:2000/1000MS(Java/Others)    MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):6387    AcceptedSubmission(s):3172ProblemDescriptionPasswordsecurityisatrickything.Usersprefersimplepas......
  • 杭电ACM HDU 3351 Seinfeld
    SeinfeldTimeLimit:2000/1000MS(Java/Others)   MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):1071   AcceptedSubmission(s):540ProblemDescriptionI’moutofstories.ForyearsI’vebeenwritingstories,somerathersilly,......
  • Virtualbox安装Linux使用2560以上高分辨率黑屏
    Virtualbox安装Linux后,通过VirtualBox的视图菜单默认只有1920的分辨率可供选择,想要使用更高分辨率(比如4K)需要在Linux系统的设置里选择。但是,通过Linux系统菜单设置分辨率达到2560时,虚拟机就会黑屏,只有鼠标。此时系统仍然正常运行,按esc可取消当前设置,按回车会确认当前设置,然后就黑......
  • 杭电多校赛第9场1002 Shortest path
    给定一个数字n,每次可以选择一项。令n=n-1令n=n/2,ifn%2==0令n=n/3,ifn%3==0求最少需要多少步可以让其变成1.减1操作可以看作是为了除法做准备,连续超过两次减1再除2是不优的,连续超过三次减1再除2也是不优的。可以根据下一步除2还是除3来分出两个分......
  • 杭电23多校第九场Capoo on tree(二分+树链剖分+可持久化线段树)
    2023HDU多校9__Capooontree(二分+树链剖分+可持久化线段树)题目链接Solution\(Hint1\)考虑如何进行对某一相同点权的所有点进行点权\(+1\)操作,如果我们建立权值线段树,那只需要将权值为\(x\)的点并入权值\(x+1\)即可,但是这样就算我们建立以节点编号为版本的可持久化线段树,也是......
  • HDU 5012
    DiceTimeLimit:2000/1000MS(Java/Others)    MemoryLimit:65536/65536K(Java/Others)TotalSubmission(s):1465    AcceptedSubmission(s):749InputTherearemultipletestcases.PleaseprocesstillEOF. Foreachcase,thefirstline......
  • hdu 5365
    LCPArrayTimeLimit:4000/2000MS(Java/Others)    MemoryLimit:131072/131072K(Java/Others)TotalSubmission(s):1223    AcceptedSubmission(s):338ProblemDescriptions=s1s2...sn,let suffi=sisi+1...sn bethesuffixstartwith......
  • HDU 5500
    ReordertheBooksTimeLimit:4000/2000MS(Java/Others)    MemoryLimit:131072/131072K(Java/Others)TotalSubmission(s):449    AcceptedSubmission(s):294ProblemDescriptionn(n≤19) booksinthisseries.Everybookhasanumberfrom ......
  • HDU 5499(模拟)
    SDOITimeLimit:2000/1000MS(Java/Others)    MemoryLimit:131072/131072K(Java/Others)TotalSubmission(s):500    AcceptedSubmission(s):210ProblemDescriptionn(n≤100) peoplecomestotheSelectandthereis m(m≤50) people......
  • HDU 4893(线段树区间更新)
    Wow!SuchSequence!TimeLimit:10000/5000MS(Java/Others)    MemoryLimit:65536/65536K(Java/Others)TotalSubmission(s):3856    AcceptedSubmission(s):1085ProblemDescriptionRecently,Dogegotafunnybirthdaypresentfromhisnewf......