Notice
Recent Posts
Recent Comments
Link
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Tags more
Archives
Today
Total
관리 메뉴

쓰고싶은거 써요

백준 파이썬 2407 조합 본문

백준 python 기록

백준 파이썬 2407 조합

우히힝 2021. 9. 19. 15:21

백준 링크:https://www.acmicpc.net/problem/2407

 

2407번: 조합

n과 m이 주어진다. (5 ≤ n ≤ 100, 5 ≤ m ≤ 100, m ≤ n)

www.acmicpc.net

 

nCm 출력문제.

 

factorial을 사용하면 간단한 식으로 풀수있다.

import math

n,m=map(int,input().split())

def factorial(n,m):
    return math.factorial(n) // (math.factorial(m)*math.factorial(n-m))

print(factorial(n,m))

n! / (m!*(n-m)!)

'백준 python 기록' 카테고리의 다른 글

백준 파이썬 2178 미로 탐색  (1) 2021.09.23
백준 파이썬 11279 최대 힙  (0) 2021.09.22
파이썬 백준 1965 상자넣기  (0) 2021.09.19
백준 파이썬 9465 스티커  (0) 2021.09.18
백준 파이썬 6603 로또  (0) 2021.09.17
Comments