95分求调,回复必关
#include <bits/stdc++.h>
using namespace std;
int a[11][11];
bool check(int x1, int y1, int x2, int y2)
{
int cnt1 = 0, cnt2 = 0;
for (int i = x1; i <= x2; i++)
{
for (int j = y1; j <= y2; j++)
{
if (a[i][j] == 1)
{
cnt1++;
}
else
{
cnt2++;
}
}
}
if (cnt1 == cnt2)
{
return true;
}
else
{
return false;
}
}
int main()
{
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
string s;
cin >> s;
for (int j = 0; j < m; j++)
{
a[i][j + 1] = s[j] - '0';
}
}
int ans = 0;
for (int x1 = 1; x1 <= n; x1++)
{
for (int y1 = 1; y1 <= m; y1++)
{
for (int x2 = 1; x2 <= n; x2++)
{
for (int y2 = 1; y2 <= m; y2++)
{
if (x1 == x2 && y1 == y2)
{
continue;
}
if (check(x1, y1, x2, y2))
{
ans = max(ans, (x2 - x1 + 1) * (y2 - y1 + 1));
}
}
}
}
}
cout << ans;
return 0;
}