#include <iostream>
using namespace std;
char board[2187][2187];
void Func(int n, int base_r, int base_c)
{
if (n == 1)
{
board[base_r][base_c] = '*'; // 별
return;
}
int new_n = n / 3;
for (int r = 0; r < new_n; r++)
for (int c = 0; c < new_n; c++)
board[base_r + new_n + r][base_c + new_n + c] = ' '; // 공백
for (int i = 0; i < 9; i++)
{
if (i == 4)
continue;
int new_r = base_r + new_n * (i / 3);
int new_c = base_c + new_n * (i % 3);
Func(new_n, new_r, new_c);
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin >> N;
Func(N, 0, 0);
for (int r = 0; r < N; r++)
{
for (int c = 0; c < N; c++)
cout << board[r][c];
cout << "\n";
}
return 0;
}
댓글남기기