GPUawa @ 2024-09-05 21:28:57
rt,代码:
#include<iostream>
using namespace std;
int n,m,ans,awa[114][114];
string s;
bool chk(int a,int b,int c,int d){
int cnt[]={0,0};
for(int i=a;i<=c;i++)
for(int j=b;j<=d;j++)
cnt[awa[i][j]]++;
return cnt[0]==cnt[1];
}
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>s;
for(int j=0;j<m;j++)
awa[i][j]=s[j]-'0';
}
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
for(int k=i;k<=n;k++)
for(int l=j;l<=m;l++)
if(chk(i,j,k,l))
ans=max(ans,(k-i+1)*(l-j+1));
cout<<ans;
}
记录
by zhs0711_update @ 2024-09-05 21:43:33
ans=0
by zhs0711_update @ 2024-09-05 21:43:50
@GPUawa ans=0
by Vicem @ 2024-09-05 21:45:05
@GPUawa 别被骗了,你的cin>>s之后应该是awa[i][j+1]=s[j]-'0';
by GPUawa @ 2024-09-05 21:52:02
@zhs0711_update 定义在main函数外面不需要初始化为0
by GPUawa @ 2024-09-05 21:53:17
@Vicem A了,thx
by zhs0711_update @ 2024-09-05 21:54:42
919191
by zhs0711_update @ 2024-09-05 21:55:22
考古
by zhs0711_update @ 2024-09-06 21:17:37
@GPUawa 谢谢,以后一定注意!