2004

Algorithm/백준

[BAEKJOON] 2004번: 조합 0의 개수

문제 nCm 의 끝자리 0의 개수를 출력하는 프로그램을 작성하시오. 코드 import sys input = sys.stdin.readline N, M = map(int, input().split()) def count_number(n, k): count = 0 while n: n //= k count += n return count five_count = count_number(N, 5) - count_number(M, 5) - count_number(N - M, 5) two_count = count_number(N, 2) - count_number(M, 2) - count_number(N - M, 2) answer = min(five_count, two_count) print(answer) 나의 생각 ..

NegotiationMan
'2004' 태그의 글 목록