Baekjoon 10992번 [별 찍기 - 17]

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

 

10992번: 별 찍기 - 17

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

www.acmicpc.net

 

  • 사용언어: Python (PyPy3)
  • 알고리즘: 구현

 

 


 

문제

 

 

 


 

코드

 

별 찍기 나랑 안맞음 재미가 없다.. 이거 재귀로도 풀 수 있는지 모르겠네

 

N = int(input())

for i in range(1, N+1):
    print(' '*(N-i), end='')
    print('*', end='')
    if i == 1:
        print('')
    elif i == N:    
        print('*'*(2*i-2))
    else:
        print(' '*(2*i-3), end='')
        print('*')

+ Recent posts