ps | |
---|---|
링크 | acmicpc.net/… |
출처 | BOJ |
문제 번호 | 16565 |
문제명 | N포커 |
레벨 | 골드 1 |
분류 |
포함배제의 원리 |
시간복잡도 | O(n) |
인풋사이즈 | n<=52 |
사용한 언어 | Python |
제출기록 | 31312KB / 68ms |
최고기록 | 60ms |
해결날짜 | 2021/10/18 |
"""Solution code for "BOJ 16565. N포커".
- Problem link: https://www.acmicpc.net/problem/16565
- Solution link: http://www.teferi.net/ps/problems/boj/16565
Tags: [Inclusion-Exclusion Principle]
"""
import math
MOD = 10007
def main():
N = int(input())
answer = 0
for i in range(1, N // 4 + 1):
count = math.comb(13, i) * math.comb(52 - 4 * i, N - 4 * i)
answer += count if i % 2 else -count
print(answer % MOD)
if __name__ == '__main__':
main()