Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 운영체제
- DP
- level3
- 힙
- 파이썬
- MYSQL
- 다이나믹 프로그래밍
- 스택
- BOJ
- 재귀
- 가상메모리 관리
- 프로그래머스
- dict
- 그리디
- BFS
- dfs
- level0
- level1
- python
- level2
- 가상메모리
- N과M
- 딕셔너리
- 수학
- 구현
- 브루트포스
- 다익스트라
- 코딩테스트
- programmers
- 백준
Archives
- Today
- Total
동캄의 코딩도장
백준 2407 [조합] 파이썬 본문
https://www.acmicpc.net/problem/2407
2407번: 조합
n과 m이 주어진다. (5 ≤ n ≤ 100, 5 ≤ m ≤ 100, m ≤ n)
www.acmicpc.net
#백준 2407
import sys
n,k=map(int,sys.stdin.readline().split())
dp=[1]*(n+1)
for i in range(2,n+1):
dp[i]=dp[i-1]*i
print(dp[n]//(dp[n-k]*dp[k]))
수학과 dp를 절묘히 조화시키면 풀 수 있는 문제이다.
'코테 > BOJ' 카테고리의 다른 글
백준 1935 [후위 표기식2] 파이썬 (0) | 2022.09.07 |
---|---|
백준 9507 [Generations of Tribbles] 파이썬 (0) | 2022.09.05 |
백준 1904 [01 타일] 파이썬 (0) | 2022.09.05 |
백준 9461 [파도반 수열] 파이썬 (0) | 2022.09.05 |
백준 16953 [A -> B] 파이썬 (0) | 2022.09.05 |