自己测试没问题交上去一片红......
查看原帖
自己测试没问题交上去一片红......
416123
sss6666楼主2021/1/4 21:46
#include<stdio.h>
#include<math.h>
#define MAX 500
void realease(int square[MAX][MAX], int x, int y, int t);
int main()
{
	int n;
	int square[MAX][MAX];
	scanf_s("%d", &n);
	int t = pow(2, n);
	for (int i = 0; i < t; i++)
		for (int j = 0; j < t; j++)
			square[i][j] = 1;
	realease(square, 0, 0, t);
	for (int i = 0; i < t; i++)
	{
		for (int j = 0; j < t; j++)
			printf("%d", square[i][j]);
		printf("\n");
	}
}
void realease(int square[MAX][MAX], int x, int y, int t)
{
	if (t == 1)
		return;
	t /= 2;
	for (int i = x; i < x + t; i++)
	{
		for (int j = y; j < y + t; j++)
			square[i][j] = 0;
	}
	realease(square, x + t, y, t);
	realease(square, x, y + t, t);
	realease(square, x + t, y + t, t);
}
2021/1/4 21:46
加载中...