1712번

김범주·2022년 7월 13일
0

백준 파이썬

목록 보기
10/29
post-thumbnail
a, b, c = map(int, input().split())

ans = (a // (c-b)) + 1

if b > c:
  print (-1)
else:
  print (ans)  

대부분의 예시는 괜찮았지만 c와 b가 같을 경우 0으로 나누는 zerodivision error가 떠서 실패...

정답

a, b, c = map(int, input().split())

if b >= c:
  print (-1)
else:
  print ((a // (c-b)) + 1)  

이렇게 분기를 해주면 b와 c가 같을 때를 통과할 수 있음!

profile
개발꿈나무

0개의 댓글