[20250924] PGM / LV3 / 합승 택시 요금 / 김수연 #969
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://school.programmers.co.kr/learn/courses/30/lessons/72413
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
두사람이 출발지 S에서 도착지 A, B를 가려고 할 때, 택시를 합승함으로써 예상 최저 택시 가격 구하기
🔍 풀이 방법
플로이드워셜 이용
각 지점에 가는데 걸리는 비용 저장해두고, 임의의 지나는 지점 k를 두고, 3중 for문 돌림
그리고 1. s->a + s->b 2. s->a->b 3. s->b->a 이 3개의 경우 중에서 가장 적게 걸리는 가격 return
⏳ 회고
보자마자 플로이드워셜이 보였다