大佬们帮忙看看,cpp
查看原帖
大佬们帮忙看看,cpp
1171041
alexxs60楼主2023/11/25 18:30
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int flag = 0;
	int count = 0;
	while (1)
	{
	
		int x;

		cin >> x;
		for (int j = 0; j < x; j++)
		{
			if (flag == 0)
			{
			
				if (count % n == 0)
				{
					cout << endl;
				}
				cout << 0;
				count++;
				if (count == n * n)
				{
					return 0;
				}
	
			}
			else if (flag == 1)
			{
			
				if (count % n == 0)
				{
					cout << endl;
				}
				cout << 1;
				count++;
				if (count == n * n)
				{
					return 0;
				}

			}
		}
		if (flag == 0)
		{
			flag = 1;
		}
		else if (flag == 1)
		{
			flag = 0;
		}
	}

	return 0;
}
2023/11/25 18:30
加载中...