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 |
Tags
- 파이썬
- 문제 풀이
- 풍선터뜨리기
- BTREE
- DP 알고리즘
- 실버
- 백준 1246번
- 해싱
- 이항계수
- 알고리즘
- 백준 14501번
- 해설
- 백준 11050번
- hashing
- 연산자 문제
- html
- 백준
- 1
- CSS
- 백준 1487번
- B-tree
- 가치규범의 공공외교
- 주창형 공공외교
- N과 M
- 0의 개수
- 1141번
- 챗봇
- 한반도평화와공공외교
- 풀이
- Python
Archives
- Today
- Total
목록백준 2004번 (1)
SunFly의 코딩 및 정보 블로그

풀이 팩토리얼을 사용하면 재귀함수를 사용하게 되어서 시간초과 가 일어난다. import sys input = sys.stdin.readline def factorial(x): res = 1 for i in range(1, x+1): res *= i return res def cnt_zero(x): cnt = 0 for i in x: if i == '0': cnt += 1 else: break return cnt n, m = map(int, input().split()) result = str(factorial(n) // (factorial(n-m) * factorial(m))) result = reversed(result) cnt = cnt_zero(result) print(cnt) 따라서 다시 생각해보..
백준(BaekJoon)
2022. 2. 26. 12:04