Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/11692
🧭 풀이 시간
45분
👀 체감 난이도
✏️ 문제 설명
1이상 N이하의 수 중, 약수의 합이 짝수인 수의 개수를 구해보자.
🔍 풀이 방법
홀수인 개수를 구해서 전체에서 빼기
약수 중 홀수의 개수가 짝수개
-> 소인수분해 했을 때 2가 아닌 것들로만 개수 구하기
N = 2^m * a1^p1 * a2^p2 * ...
라고 하면, N의 홀수인 약수의 개수는 (p1+1) * (p2+1) * ...
이게 홀수이려면 pk+1 이 모두 홀수여야 함. == pk가 모두 짝수여야 함.
-> 소인수분해의 결과가, 2를 제외한 다른 소수들은 모두 짝수번 곱해져있는 꼴이어야 함.
1부터 출발해서 DFS느낌으로 백트래킹, 수가 크니까 HashSet으로 중복 방지
⏳ 회고
시간 초과가 나야 하는 풀이같은데 억지로 뚫은 느낌...
개어려운데 왜 골드지