[백준] 13015번 : 별 찍기-23 - Python(파이썬)

강재원·2022년 10월 29일
0

[코딩테스트] Python

목록 보기
165/200
post-custom-banner



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

n=int(input())
arr=[[0]*(4*n-3) for _ in range(2*n-1)]
for i in range(2*n-1):
    for j in range(4*n-3):
        arr[i][j]=' '
for i in range(n):
    arr[0][i]='*'
    arr[0][4*n-4-i]='*'
for i in range(1,n):
    arr[i][i]='*'
    arr[i][i+n-1]='*'
    arr[i][4*n-4-i]='*'
    arr[i][4*n-4-i-n+1]='*'
for i in range(2*n-2,n-1,-1):
    for j in range(4*n-3):
        arr[i][j]=arr[2*n-2-i][j]
for i in range(n):
    for j in range(4*n-3-i):
        print(arr[i][j],end='')
    print()
for i in range(n,2*n-1):
    for j in range(2*n-1+i):
        print(arr[i][j],end='')
    print()
profile
개념정리 & 문법 정리 & 알고리즘 공부
post-custom-banner

0개의 댓글