[20250806] / BOJ / G4 / 인구 이동 / 이강현 #619
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/16234
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
NxN 나라에서 인접한 두 국가의 인구수 차이가 L 이상 R 이하인 경우 국경을 열어서
인구 이동을 진행한다. 이때 서로 나라간 이동이 가능한 경우 그 나라들을 연합이라고 한다.
연합에서의 인구이동은 연합내 모든 나라의 인구 수 합을 연합에 속한 나라의 수로 나누는 것이다.(소수점은 버린다)
인구이동이 일어나는 횟수를 출력하라.
🔍 풀이 방법
BFS
그냥 BFS하고 이동 여부 파악하고 q에 들어갔던 애들끼리만 인구수 조정하고 했음.
⏳ 회고
그냥 구현 하면 됐다. 함정없는 BFS 문제