[백준 2446번] 별찍기-2446

2020. 7. 8. 13:34Algorithm/practice

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

 

2446번: 별 찍기 - 9

첫째 줄부터 2×N-1번째 줄까지 차례대로 별을 출력한다.

www.acmicpc.net

n = int(input())
lines = 2*n
for i in range(1, lines):
    starNum = 2*(n-i)+1 if i <= n else 2*(i-n)+1
    spaceNum = i-1 if i <= n else lines-i-1
    print(spaceNum*' ' + starNum * '*')

'Algorithm > practice' 카테고리의 다른 글