[20260129] BOJ / G2 / 합이 0인 네 정수 / 김민진 #1854
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.
🧷 문제 링크
합이 0인 네 정수
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
크기가 똑같은 배열 4개가 주어짐
각 배열에서 임의의 수를 하나씩 고를 때 네 수의 합이 0이 되는 조합의 수는?
🔍 풀이 방법
A,B/C,D에서 하나씩 뽑아서 나오는 값을AB,CD에 저장, 정렬AB와CD를 한꺼번에 순회하면서 조합 갯수 찾기→ 0이 되는 수가 나오면 이후로 같은 수가 나오는지 확인 후
AB 갯수 * CD 갯수를cnt에 더하기⏳ 회고
뭔 리스트도 안돼 해시맵도 안돼
오로지 배열로만 풀어야함
어쩐지 시간제한이 12초더라 eww