提交时间:2023-12-01 21:34:00
运行 ID: 32563
#include<iostream> using namespace std; int a[100][100]; void dequ(int n,int m,int x,int y){ if(n==0){ a[x][y]=m; }else{ n--; int size=1<<n; dequ(n,m,x,y); dequ(n,m+size,x,y+size); dequ(n,m+size,x+size,y); dequ(n,m,x+size,y+size); } } int main(){ int m; cin>>m; dequ(m,1,0,0); int n=1<<m; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cout<<a[i][j]<<" "; } cout<<"\n"; } }