문제 바로가기> 백준 2869번: 달팽이는 올라가고 싶다
V-A를 한 이유는 마지막 날 달팽이는 떨어지지 않고 올라가기만 할 것이기 때문이다.
def solution():
import sys
A, B, V = map(int, sys.stdin.readline().rstrip().split())
if (V-A)%(A-B)!=0: print((V-A)//(A-B)+2)
else: print((V-A)//(A-B)+1)
solution()
다음과 같이 간단하게 작성할 수도 있다.
def solution():
import sys
A, B, V = map(int, sys.stdin.readline().rstrip().split())
print((V-A)//(A-B)+1+(((V-A)%(A-B))!=0))
solution()