SOS!!!
查看原帖
SOS!!!
348644
kevin_max楼主2020/10/30 18:35
#include <bits/stdc++.h>

using namespace std;

int qipan[110];
int dp[110][110];

int main ()
{
	int n,s=0;
	int top=1;
	bool flag;
	cin>>n;
	if (n==2)
	{
		cout<<"2"<<endl;
		cout<<"01"<<endl;
		cout<<"11"<<endl;
		return 0;
	}
	memset (qipan,0,sizeof (qipan));
	for (int i=1; i<=n; i++)
	{
		flag=true;
		for (int i=1; i<=n; i++)
		{
			if (qipan[i]==0) { flag=false; break; }
		}
		if (flag) break;
		for (int j=1; j<=top; j++) { qipan[j]!=qipan[j]; }
		for (int j=top+1; j<=n-1-top; j++) { qipan[j]=!qipan[j]; }
		for (int j=1; j<=n; j++) dp[s][j]=qipan[j];
		top++;
		s++;
	}
	cout<<s<<endl;
	for (int i=1; i<=s; i++)
	{
		for (int j=1; j<=n; j++) cout<<dp[i][j];
		cout<<endl;
	}
	return 0;
}

走过路过的同志们,能为我提供一下思路吗?

2020/10/30 18:35
加载中...