T5
2025-07-27 22:04:38
发布于:上海
40阅读
0回复
0点赞
《肝 帝 解 法》
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,a[1100][1100],b[5][5];
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<=3;i++){
for(int j=1;j<=3;j++){
cin>>b[i][j];
}
}for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(a[i][j]==b[1][1] and a[i][j+1]==b[1][2] and a[i][j+2]==b[1][3] and
a[i+1][j]==b[2][1] and a[i+1][j+1]==b[2][2] and a[i+1][j+2]==b[2][3] and
a[i+2][j]==b[3][1] and a[i+2][j+1]==b[3][2] and a[i+2][j+2]==b[3][3]){
cout<<"YES";
return 0;
}
}
}cout<<"NO";
return 0;
}
全部评论 1
#include<bits/stdc++.h> using namespace std; int n,m; int a[1100][1100]; int b[20][20]; 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<=3;i++){ for(int j=1;j<=3;j++){ cin>>b[i][j]; } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(a[i][j]==b[1][1]&&a[i][j+1]==b[1][2]&&a[i][j+2]==b[1][3]&&a[i+1][j]==b[2][1]&&a[i+2][j]==b[3][1]&&a[i+1][j+1]==b[2][2]&&a[i+1][j+2]==b[2][3]&&a[i+2][j+1]==b[3][2]&&a[i+2][j+2]==b[3][3]){ cout<<"YES"; return 0; } } } cout<<"NO"; }
我的一样
3天前 来自 浙江
0
有帮助,赞一个