一道acm水编程题,高分求解答,解答后加加悬赏分
ProblemB:CounttherectanglesTimeLimit:1SecMemoryLimit:128MBSubmit:24Solved:7[Submit][S...
Problem B: Count the rectangles
Time Limit:1 Sec Memory Limit:128 MB
Submit:24 Solved:7
[Submit][Status][Web Board]
Description
You are given numbers of rectangles made of '1's and '0's.Calculate how many small rectangles which have four '1's on the four corners.
Input
There are several test cases, each test case starts with a line containing two positive integers n and m. n and m is the size of the rectangle (1<=n<=100, 1<=m<=100). Next follow a rectangle which contains only number '0' and '1'. The input will finish with the end of file.
Output
The number of rectangles which meet the requirements.
Sample Input
3 4
1 0 1 0
0 1 1 0
1 1 1 0
Sample Output
2
说一下思路就行了
就是输入一个矩阵 求出这个矩阵包含多少个小矩阵 小矩阵的四周都为1 展开
Time Limit:1 Sec Memory Limit:128 MB
Submit:24 Solved:7
[Submit][Status][Web Board]
Description
You are given numbers of rectangles made of '1's and '0's.Calculate how many small rectangles which have four '1's on the four corners.
Input
There are several test cases, each test case starts with a line containing two positive integers n and m. n and m is the size of the rectangle (1<=n<=100, 1<=m<=100). Next follow a rectangle which contains only number '0' and '1'. The input will finish with the end of file.
Output
The number of rectangles which meet the requirements.
Sample Input
3 4
1 0 1 0
0 1 1 0
1 1 1 0
Sample Output
2
说一下思路就行了
就是输入一个矩阵 求出这个矩阵包含多少个小矩阵 小矩阵的四周都为1 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询