0分求调,玄关
查看原帖
0分求调,玄关
1329354
Johnson31楼主2025/6/26 14:48
#include<bits/stdc++.h>
using namespace std;
int n,m,a[15][15],mx;
bool check(int x,int y,int xx,int yy){
    int h=0,b=0;
    for(int i=x;i<=xx;i++){
        for(int j=y;j<=yy;j++){
            if(a[i][j]==1)h++;
            else b++;
        }
    }
    if(h==b)return 1;
    else return 0;
}
int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>a[i][j];
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            for(int ii=i;ii<=n;ii++){
                for(int jj=j;jj<=m;jj++){
                    if(check(i,j,ii,jj)){
                        mx=max(mx,(ii-i+1)*(jj-j+1));
                    }
                }
            }
        }
    }
    cout<<mx;
	return 0;
}
2025/6/26 14:48
加载中...