https://www.acmicpc.net/problem/1712
1712번: 손익분기점
월드전자는 노트북을 제조하고 판매하는 회사이다. 노트북 판매 대수에 상관없이 매년 임대료, 재산세, 보험료, 급여 등 A만원의 고정 비용이 들며, 한 대의 노트북을 생산하는 데에는 재료비와
www.acmicpc.net
시간 복잡도를 고려해야한다.
그러나 꼼수를 사용한 것 같다.. 정확한 풀이를 알아보자.
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 |