Code&Data Insights
BaekJoon Algorithm - Stage 4 [ 1-3 ], Stage 5 [ 1-3 ] ( Python 3 ) 본문
BaekJoon Algorithm - Stage 4 [ 1-3 ], Stage 5 [ 1-3 ] ( Python 3 )
paka_corn 2022. 1. 15. 00:172022.01.14
# 1. Stage 4 - while loop
[my code]
a,b = map(int,input().split())
while a > 0 and b < 10:
print(a+b)
a,b = map(int,input().split())
if a <= 0 or b > 10:
break
* try ~ except *
더 간단하게 표현 가능
[new code]
while True:
try:
a,b = map(int,input().split())
print(a+b)
except:
break
** while True **
---> The "while true" loop in python runs without any conditions until the break statement executes inside the loop.
# 2. Stage 4 - 1110번
계속 고민했는데 당최모르겠다..ㅎ
정수랑 str쓰는거 까진 생각했는데.
결국 구글링하다 다른분 답 참고했다.
https://wook-2124.tistory.com/222
다시 풀어야할듯..! 주말에 다시 풀문제
# 3. Stage 5 - 1 dimensional array
[2562- for + input + array]
[my code]
x = []
for i in range(9):
i = int(input())
x.append(i)
print(max(x))
print(x.index(max(x)) + 1)
--------------------------------------
[2577 - count() + str()]
[my code]
a = int(input())
b = int(input())
c = int(input())
num = str(a*b*c)
count_num = [int(x) for x in num]
for i in range(10):
print(count_num.count(i))
머리 터질거 같아서 오늘은 일단 여기까지...하핳..
'Algorithm > BaekJoon Online Judge' 카테고리의 다른 글
BaekJoon Algorithm - Stage 6[1], Stage 7 [ 1-4 ] ( Python 3 ) (0) | 2022.01.16 |
---|---|
BaekJoon Algorithm - Stage 5 [ 4-7 ] ( Python 3 ) (0) | 2022.01.15 |
BaekJoon Algorithm - Stage 3 [ 1-11 ] ( Python 3 ) (0) | 2022.01.15 |
BaekJoon Algorithm - Stage 2 [ 1-5 ] ( Python 3 ) (0) | 2022.01.13 |
BaekJoon Algorithm - Stage 1 [ 1-11 ] ( Python 3 ) (0) | 2022.01.12 |