-Code
i = 0
while 1:
i += 1
result = ""
dead = False
o, w = map(int, input().split())
if o == w == 0:
break
while 1:
play, n = input().split()
n = int(n)
if play == '#' and n == 0:
break
if play == 'F':
w += n
else:
w -= n
if w <= 0:
dead = True
if dead:
result = f"{i} RIP"
else:
if o / 2 < w < o * 2:
result = f"{i} :-)"
else:
result = f"{i} :-("
print(result)
한번 몸무게가 0 이하로 내려간 후 올라갔을 경우를 생각을 못해서 틀렸었습니다.
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 1673번 치킨 쿠폰 (0) | 2022.05.27 |
---|---|
[백준/파이썬] 1392번 노래 악보 (0) | 2022.05.27 |
[백준/파이썬] 25175번 두~~부 두부 두부 (0) | 2022.05.27 |
[백준/파이썬] 25165번 영리한 아리의 포탈 타기 (0) | 2022.05.27 |
[백준/파이썬] 24724번 현대모비스와 함께하는 부품 관리 (0) | 2022.05.27 |