提交时间:2019-11-16 19:25:39
运行 ID: 2259
#include<cstdio> const int MAXN=33,MAXM=5; int matchlist[MAXN][MAXN]; int m; int main(){ scanf("%d",&m); int n=1<<m,k=1,half=1; matchlist[0][0]=1; while (k<=m){ for (int i=0;i<half;i++) for (int j=0;j<half;j++) matchlist[i][j+half]=matchlist[i][j]+half; for (int i=0;i<half;i++) for (int j=0;j<half;j++){ matchlist[i+half][j]=matchlist[i][j+half]; matchlist[i+half][j+half]=matchlist[i][j]; } half*=2; k++; } for (int i=0;i<n;i++){ for (int j=0;j<n;j++) printf("%3d",matchlist[i][j]); putchar('\n'); } return 0; }