RT,前面9个点都能过- -萌新第一次写递归 99孩子
#include <iostream>
#include <cmath>
using namespace std;
int legth=1;
const int maxn=1080;
bool s[maxn][maxn]={1};
bool doit(int x,int a,int b){
if(x==2){
s[a][b]=0;
return true;
}
for(int i=a;i<x/2+a;i++){
for(int j=b;j<b+x/2;j++){
s[i][j]=0;
}
}
doit(x/2,a,b+x/2);
doit(x/2,x/2+a,b);
doit(x/2,x/2+a,x/2+b);
}
int main(){
int n;
cin>>n;
legth=pow(2,n);
for(int i=0;i<=legth;i++){
for(int j=0;j<=legth;j++){
s[i][j]=1;
}
}
doit(legth,0,0);
for(int i=0; i<legth; i++){
for(int j=0; j<legth-1; j++){
cout<<s[i][j]<<" ";
}
cout<<s[i][legth]<<endl;
}
return 0;
}