YWJ20140130 @ 2024-10-28 22:32:39
感觉是对的
#include<bits/stdc++.h>
#define N 1001
#define io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int s[N][N];
int n, m, y = 0;
int main() {
io
cin >> n >> m;
for (int i = 1; i <= n; i++) {
string ss;
cin >> ss;
for (int j = 1; j <= m; j++) {
s[i][j] = s[i - 1][j] + s[i][j - 1]\
- s[i - 1][j - 1]\
+(ss[j] - '0');
}
}
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++) {
if (s[i][j] == i * j / 2){ y = max(y, i * j);
cout<<i<<' '<<j<<"\n";}
}
cout << y;
return 0;
}