본문 바로가기
python-algorithm

[백준] 14624

by 무적김두칠 2021. 1. 14.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import math
n=int(input())
if n%2==0  : print("I LOVE CBNU")
else:
    cnt= math.ceil(n/2)
    print("*"*n)
    print(" "*(cnt-1),end='')
    print("*")
    for i in range(1,cnt):
        print(" "*(cnt-i-1),end='')
        print("*",end='')
        print(" " * (2*i-1), end='')
        print("*",end='')
        print()
cs

별찍기 문제류랑 비슷합니다.
반복문에 대한 이해를 할 수 있는 문제입니다 ㅎ

반응형

'python-algorithm' 카테고리의 다른 글

[백준] 14697  (0) 2021.01.15
[백준] 14659  (0) 2021.01.14
[백준] 14593  (0) 2021.01.14
[백준] 14581  (0) 2021.01.14
[백준] 14487  (0) 2021.01.14

댓글