#include <iostream>
using namespace std;
char board[3073][6147]; // 3<=row<=3*2^k, 5<=col<=3*2^(k+1)-1
void Func(int n, int base_r, int base_c)
{
if (n == 3) // 별 찍기
{
for (int i = 0; i < 5; i++)
{
int new_c = base_c + i;
board[base_r][new_c] = '*';
if (i == 1 || i == 3)
board[base_r - 1][new_c] = '*';
else if (i == 2)
board[base_r - 2][new_c] = '*';
}
return;
}
int new_n = n / 2;
Func(new_n, base_r, base_c);
Func(new_n, base_r, base_c + n);
Func(new_n, base_r - new_n, base_c + new_n);
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin >> N;
Func(N, N - 1, 0);
for (int i = 0; i < N; i++)
{
for (int j = 0; j < 2 * N - 1; j++)
{
if (board[i][j] == '\0') // 공백
cout << ' ';
else
cout << board[i][j];
}
if (i != N - 1)
cout << '\n';
}
return 0;
}
댓글남기기