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))
'Programming > Python' 카테고리의 다른 글
Python_tkinter_Simple Stock Index_미국주식지표 (0) | 2021.03.04 |
---|---|
BAEKJOON_Python_10250_ICPC_Nationwide Internet Competition_ACM Hotel (0) | 2021.02.28 |
BAEKJOON_Python_1193_분수찾기 (0) | 2021.02.27 |
Python_Tkinter_계산기 만들기_StringVar (0) | 2021.02.27 |
BACKJOON_Python_2292 (0) | 2021.02.25 |