[20250911] PGM / LV2 / 시소 짝꿍 / 김수연 #870
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/152996
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
놀이터에 시소가 하나 있고, 시소의 중심으로부터 2, 3, 4 거리의 지점에 좌석이 하나씩 있을 때,
시소를 두 명이 마주 보고 탄다고 할 때, 시소가 평형인 상태를 이룰 수 있는 두 사람을 시소 짝꿍이라고 한다.
탐승한 사람의 무게 x 좌석 간 거리 가 같아야함
시소 짝꿍이 몇 쌍 존재하는지 구하기
🔍 풀이 방법
HashMap 사용
한 사람이 2,3,4 각각의 자리에 앉았을 때 필요한 시소 짝꿍의 무게를 HashMap에 넣어두고, 해당하는 사람이 존재하면 answer를 늘려줌
⏳ 회고
쉬움