[20250729] BOJ / G4 / PC방 요금 / 이종환 #570
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/9080
🧭 풀이 시간
90분
👀 체감 난이도
✏️ 문제 설명
일반 요금으로 시간당 1000원 씩을 받으며, 야간 정액을 끊으면 5000원만 내고 밤 10시부터 다음날 아침 8시까지 사용할 수 있다. 이 PC방에서는 1시간에서 1분이라도 넘으면 새로운 1시간에 대한 요금을 부과한다. 그리고 이미 일반 요금으로 사용을 하다가 야간 정액을 쓰게 되면 일반 요금을 미리 계산을 하고 야간 정액을 쓸 수 있다. 즉, 일반 요금을 쓰다가 야간 정액을 쓰고 다시 일반 요금을 쓰게 되면 두 개의 일반 요금을 각각 따로 계산이 된다.
시작 시간과, 기간이 주어지면, PC방에 소요되는 최소요금을 구하여라
🔍 풀이 방법
결국 핵심은 밤->낮, 낮 ->밤이다. 이때를 각각 3,4가지의 케이스로 나누어서 전부 별도의 로직으로 처리해주었다.
이때 밤으로 넘어갈때 반드시 딱 오후 10시부터 시작이 아니라는 점을 잘 인지하고 해야한다.
⏳ 회고
분명히 이전에 상어를 하도 풀어서 구현/시뮬은 자신있었는데 이번에는 계속 조건을 하나씩 빼먹어서 한참걸렸다.... B형까지 이런거 더풀어봐야지