BOJ - 16505 - 별

Updated:

import sys

def recursion(arr, x, y, n):
    if n == 1:
        arr[x][y] = '*'
        return

    n //= 2
    recursion(arr, x, y, n)
    recursion(arr, x + n, y, n)
    recursion(arr, x, y + n, n)

def solution():
    N = int(input())
    arr = [[' ' for _ in range(1<<N)] for _ in range(1<<N)]

    recursion(arr, 0, 0, 1<<N)

    for i in arr:
        print(''.join(i).rstrip())

solution()

https://www.acmicpc.net/problem/16505

Categories:

Updated:

Leave a comment