求助大佬!!!
  • 板块P5461 赦免战俘
  • 楼主_YQY
  • 当前回复1
  • 已保存回复1
  • 发布时间2022/2/20 10:37
  • 上次更新2023/10/28 08:05:44
查看原帖
求助大佬!!!
638274
_YQY楼主2022/2/20 10:37
#include<bits/stdc++.h>
using namespace std;
int a[11][11];
int main(){
	int n,x;
	cin>>n;
	x=pow(2,n);
	a[1][1]=1;
	for(int i=1;i<=x;i++)
	{
		a[i][1]=1;
		a[i][i]=1;
		for(int j=x-i;j>=0;j--)
		{
			cout<<"0 ";
		}
		for(int j=1;j<=i;j++)
		{
			a[i][j]=a[i-1][j]+a[i-1][j-1];
			if(a[i][j]%2==0)
			cout<<"1 ";
			else
			cout<<"0 ";
		}
		cout<<endl; 
	}
	return 0;
}
2022/2/20 10:37
加载中...