代码看不出问题,求调
查看原帖
代码看不出问题,求调
1643970
JevinWhite楼主2025/8/31 19:39

这段代码已经修改了很多次,甚至问了AI,他说:
这是一段非常完美的代码
可是分数是微妙的0分……
甚至多个AI都是如此……
求调😢

#include<bits/stdc++.h>
using namespace std;
int n,m,t;
int a[115][115]={};
const int bz[4][4]={0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0};
bool dfs(int x,int y){
	for(int i=0;i<4;++i){
		for(int j=0;j<4;++j){
			if(a[x+i][y+j]!=bz[i][j]) return 0;
		}
	}
	return 1;
}
int main(){
    cin>>t;
    while(t--){
        bool flag=0;
        cin>>n>>m;
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                cin>>a[i][j];
            }
        }
        if(n<4||m<4){
        	cout<<"No"<<endl;
        	continue;
		}
        for(int i=1;i<=n-3;++i){
            for(int j=1;j<=m-3;++j){
                if(dfs(i,j)){
					flag=1;
					break;
				}
            }
            if(flag)break;
        }
        if(flag)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}
2025/8/31 19:39
加载中...