[20251022] BOJ / G3 / 좋은 수 / 권혁준 #1197
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/5624
🧭 풀이 시간
10분
👀 체감 난이도
✏️ 문제 설명
길이 N인 배열의 어떤 수가 그 앞에 있는 수 세 개의 합으로 나타내어지면 좋은 수라고 한다.
좋은 수의 개수를 구해보자.
🔍 풀이 방법
A[i] + A[j]+ A[k] = A[x]인 i,j,k < x를 찾는 것으로 생각할 수 있다.
변형하면 A[i] + A[j] = A[x] - A[k]가 된다.
x를 현재 보고 있는 인덱스라고 가정하고 k를 완탐으로 찾으면 A[x] - A[k]는 구할 수 있다.
이전까지의 A[i] + A[j] 값들 중 A[x] - A[k]가 존재하는지 확인하면 된다.
⏳ 회고
eez