-
[백준] 11050 python- 이항 계수 1(브론즈 1)알고리즘 문제/풀어본 것 2022. 10. 22. 16:01
https://www.acmicpc.net/problem/11050
1트
이항 계수(binominal coefficient)
import math math.factorial() math.comb(n, k) math.perm(n, k)
combinations_with_replacement()
# iterable 객체, 뽑고자 하는 수 from itertools import product from itertools import combinations from itertools import combinations_with_replacement from itertools import permutations
#내 풀이
import sys import math def binomial_coefficient(n, k): factorial = math.factorial return factorial(n) // (factorial(n-k) * factorial(k)) n, k = map(int, sys.stdin.readline().rstrip().split()) # print(binomial_coefficient(n, k)) print(math.comb(n, k))
'알고리즘 문제 > 풀어본 것' 카테고리의 다른 글
[백준] 2798 python - 블랙잭(브론즈 2) (0) 2022.10.22 [백준] 2751 python- 수 정렬하기 2(실버 5) (0) 2022.10.22 [백준] 10828, 10845, 10866 python - 스택, 큐, 덱(실버 4) (0) 2022.10.22 [백준] 10816 python- 숫자 카드 2(실버 4) (0) 2022.10.22 [백준] 10816 - 숫자 카드 2(실버 4) (0) 2022.10.18