10分求助
查看原帖
10分求助
760418
not_exist楼主2022/8/17 15:40
#include<bits/stdc++.h>
using namespace std;

typedef long double ld;
typedef string sg;
typedef long lg;
typedef double de;
typedef char ch;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef bool bl;

int main()
{
	int n;
	cin>>n;
	n=pow(2,n);
	int x[n][n]={0};
	for(int i=n/2;i<n;i++){
		x[i][0]++;
	}
	for(int i=1;i<n;i++){
		for(int j=0;j<n-1;j++){
			x[j][i]=(x[j][i-1]+x[j+1][i-1])%2;
		}
		x[n-1][i]=1;
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cout<<x[j][i]<<" ";
		}
		cout<<endl;
	}
	return 0;
}
2022/8/17 15:40
加载中...