[백준] #1712 손익 분기점 python
2022. 12. 23. 16:10
https://www.acmicpc.net/problem/1712
시간 복잡도를 고려해야한다.
그러나 꼼수를 사용한 것 같다.. 정확한 풀이를 알아보자.
default_cost, factory_cost, product_cost = map(int, input().split())
cnt = 0
if factory_cost >= product_cost:
print(-1)
else:
while True:
cnt += 10000
if default_cost + factory_cost * cnt < product_cost * cnt:
break
while True:
cnt -= 1
if default_cost + factory_cost * cnt >= product_cost * cnt:
break
print(cnt+1)
'Programming > Algorithm' 카테고리의 다른 글
[백준] #21193 분수 찾기 python (0) | 2022.12.23 |
---|---|
[백준] #2292 벌집 python (0) | 2022.12.23 |
[백준] #1316 그룹 단어 체커 python (0) | 2022.12.23 |
[백준] #2941 if문으로 예외 처리 python (0) | 2022.12.22 |
[백준] #5622 다이얼 python (0) | 2022.12.22 |