https://www.acmicpc.net/problem/7595
7595번: Triangles
Each line of input contains a single positive integer, n, 1 <= n <= 100. The last line of input contains 0. For each non-zero number, draw a triangle of that size.
www.acmicpc.net
1
2
3
4
5
6
7
8
9
|
def sol(n):
for i in range(1,n+1):
print('*'*i)
if __name__ == '__main__':
while True:
n=int(input())
if n ==0 :
break
sol(n)
|
cs |
소위 별찍기 문제죠, 반복문과 출력을 이용하시면됩니다
There are so many similar problems in baekjoon(acmicpc.net),
Use Print, Loop
반응형
'python-algorithm' 카테고리의 다른 글
백준 11121 Communication Channels (0) | 2022.11.15 |
---|---|
백준 8718 Bałwanek (0) | 2022.11.15 |
백준 16099 Larger Sport Facility (0) | 2022.11.15 |
백준 23235 The Fastest Sorting Algorithm In The World (0) | 2022.11.15 |
백준 25311 UCPC에서 가장 쉬운 문제 번호는? (0) | 2022.11.15 |
댓글