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/1095
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
S개의 마법의 구슬과, F개의 가짜 구슬이 있다.
N명의 사람을 모아서, S+F개 중 모든 S개의 조합을 테스트하기로 했다.
N명이 각각 테스트하는 조합의 개수는 동일해야 한다고 할 때, M을 넘지 않으면서 뽑을 수 있는 최대 사람 수를 구해보자.
🔍 풀이 방법
[사용한 알고리즘]
문제를 보기 쉽게 바꿔 쓰면,
$Comb(S+F, S)$ 의 약수 중 $M$ 이하의 가장 큰 수를 구하는 것이다.
=>
C[x] = x로 나누어떨어지는 횟수가 된다.M이하의 각 수 i에 대해서 가능한지 판별할 때는, i를 소인수분해한 결과가 각각 C보다 개수가 작거나 같은지 확인하면 된다.
⏳ 회고
....