[20250306] BOJ / P3 / N!!!...! mod P / 권혁준 #210
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/18373
🧭 풀이 시간
120분
👀 체감 난이도
✏️ 문제 설명
🔍 풀이 방법
[사용한 알고리즘]
사전 지식
페르마의 소정리
윌슨의 정리
=>
윌슨의 정리와 페르마의 소정리를 이용하면
거듭제곱은 분할 정복을 이용한 거듭제곱으로 빠르게 계산할 수 있다.
⏳ 회고
계속 고민하다가, 이거 못 풀면 잠을 못 잘 것 같아서 풀이를 찾아봤다.
윌슨의 정리는 진짜 살면서 이름조차 처음 들어봤다.
결국 이건 모르면 못 푸는 문제였다. 더 시간 낭비 안하고 찾아봐서 다행인듯