2869번 – 달팽이는 올라가고 싶다

문제

https://www.acmicpc.net/problem/2869

풀이

코드

def answer():
  global a, b, v
  if a == v:
    print(1)
    return
  ans = 0
  va = (v-a)
  ab = (a-b)
  ans += va//ab
  if va%ab != 0: ans += 2
  else: ans += 1
  print(ans)

  
a, b, v = map(int, input().split())
answer()

Leave a Reply

Your email address will not be published.