'commit'
This commit is contained in:
35
TangDou/LanQiaoBei/LanQiao14STEMA202302/4.cpp
Normal file
35
TangDou/LanQiaoBei/LanQiao14STEMA202302/4.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
const int N = 110;
|
||||
int n, m;
|
||||
int a[N][N], s[N][N];
|
||||
int res;
|
||||
/*
|
||||
4 5
|
||||
1 1 0 0 0
|
||||
1 0 1 0 0
|
||||
0 0 0 1 1
|
||||
0 0 0 1 0
|
||||
|
||||
答案:6
|
||||
*/
|
||||
int main() {
|
||||
cin >> n >> m;
|
||||
for (int i = 1; i <= n; i++)
|
||||
for (int j = 1; j <= m; j++) {
|
||||
cin >> a[i][j];
|
||||
s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + a[i][j];
|
||||
}
|
||||
|
||||
for (int x1 = 1; x1 <= n; x1++)
|
||||
for (int y1 = 1; y1 <= m; y1++)
|
||||
for (int x2 = x1 + 1; x2 <= n; x2++)
|
||||
for (int y2 = y1 + 1; y2 <= m; y2++) {
|
||||
if (s[x2][y2] - s[x1 - 1][y2] - s[x2][y1 - 1] + s[x1 - 1][y1 - 1] == 0)
|
||||
res = max(res, (x2 - x1 + 1) * (y2 - y1 + 1));
|
||||
}
|
||||
|
||||
printf("%d\n", res);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user