[20250719] BOJ / G3 / 네 개의 소수 / 이종환 #499
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/1153
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
임의의 자연수가 주어지면, 이를 네 개의 소수의 합으로 분해하는 프로그램을 작성하시오
🔍 풀이 방법
옛날에 스쳐지나가면서 보았을 때는 어떻게 푸는 지 몰랐었는데, 그 이후에 골드바흐 추측을 알게되었다.
골드바흐 추측을 약간만 변형하면
// 8 이상의 짝수는 항상 네 소수의 합으로 표현 가능하다-> 두 소수 + 2 + 2
// 9 이상의 홀수는 항상 네 소수의 합으로 표현 가능하다.-> 세 소수 + 2
이를 도출할 수 있다.
이 후 에라스토테네스의 체로 풀면 끝.
⏳ 회고
방법만 알면 정말 쉬운문제