Programming/Python

BAEKJOON_Python_2869_Croatian Open Competition in Informatics_Puz_달팽이는 올라가고 싶다

Bear_V 2021. 2. 28. 03:20

Question

There is a snail on the ground. It wants to climb to the top of a wooden pole with the height of V meters, measuring from the ground level. In one day it can climb A meters upwards, however during each night it sleeps, sliding B meters back down. Determine the number of days it needs to climb to the top.

Input

The first and only line of input contains three integers separated by a single space: A, B, and V (1 ≤ B < A ≤ V ≤ 1 000 000 000), with meanings described above. 

Output

The first and only line of output must contain the number of days that the snail needs to reach the top. 


문제

땅 위에 달팽이가 있다. 이 달팽이는 높이가 V미터인 나무 막대를 올라갈 것이다.

달팽이는 낮에 A미터 올라갈 수 있다. 하지만, 밤에 잠을 자는 동안 B미터 미끄러진다. 또, 정상에 올라간 후에는 미끄러지지 않는다.

달팽이가 나무 막대를 모두 올라가려면, 며칠이 걸리는지 구하는 프로그램을 작성하시오.

입력

첫째 줄에 세 정수 A, B, V가 공백으로 구분되어서 주어진다. (1 ≤ B < A ≤ V ≤ 1,000,000,000)

출력

첫째 줄에 달팽이가 나무 막대를 모두 올라가는데 며칠이 걸리는지 출력한다.


복잡하게 생각하지말고 단순 수식으로 풀어버리자.

from math import *
A, B, V = map(int, input().split())

'''
V = 높이
A = 낮에 올라갈 수 있는 거리
B = 밤에 미끄러지는 거리
정상에 올라가면 미끄러지지 않음

V-B = (A-B)x
'''

day = ((V-B)) / ((A-B))    
print(ceil(day))