Ice_Fist @ 2023-08-15 11:43:09
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[31][31],n;
int l[100];
int o[31]={2};
int p[31]={2};
signed main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
scanf("%d",&a[i][j]);
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(a[i][j]==1&&a[i+2][j]!=0&&o[i]==2){
o[i]=0;
}
if(a[i][j]==1&&a[i+2][j]==0&&o[i]==0||a[i][j]==1&&a[i+2][j]==0&&o[i]==2){
o[i]=1;
p[i]=1;
if(a[i][j]==1&&a[i-1][j]==0){
p[i]==0;
}
if(a[i][j]==1&&p[i]==0){
o[i]=0;
}
}
if(o[i]==0&&a[i][j]==0&&a[i-1][j]==1){
a[i][j]=1;
}
if(a[i][j]==0&&o[i]==0)
a[i][j]=1;
}
}
for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)if(a[i][j]==0)a[i][j]=2;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
printf("%d",a[i][j]);
}
printf("\n");
}
return 0;
}
by SNXL @ 2023-08-31 14:02:52
这是广搜的题...
by ypylcs @ 2023-09-05 21:09:59
@lmayyds 这是道搜索题啊
by wenjinhang @ 2023-09-21 18:14:55
广搜......