백준문제풀이/기본수학1

1712 -- 다시풀어보기

포비용 2022. 12. 24. 16:32
import sys

sys.stdin = open("input.txt","rt")

a,b,c = map(int, sys.stdin.readline().split())


total_b = 0
original_notebook = 0
total_notebook = a
cnt = 0

while True:

    total_b += b

    total_notebook = a

    total_notebook += total_b

    original_notebook += c

    if total_notebook >= original_notebook:
        cnt += 1

    elif total_notebook < original_notebook:
        cnt += 1
        break
        
        
  -------------------------
  
  # 시간초과
  
  import sys

sys.stdin = open("input.txt","rt")

fit_price,add_price,ori_price = map(int, sys.stdin.readline().split())

cnt = 1

if add_price >= ori_price:
    print(-1)

while True:

    total_price = fit_price + (add_price * cnt)

    sell_price = ori_price * cnt

    if sell_price > total_price:
        print(cnt)
        break

    cnt += 1
    
 ------------------
 # 정답
 
 import sys

sys.stdin = open("input.txt","rt")

fit_price,add_price,ori_price = map(int, sys.stdin.readline().split())

if add_price >= ori_price:
    print(-1)

else:
    print(int(fit_price/(ori_price - add_price) + 1))