๋ฐฑ์ค 1676๋ฒ
์ฃผ์ด์ง ์์ ํฉํ ๋ฆฌ์ผ์ ๊ตฌํ๋ค์ ๋ค์์๋ถํฐ 0์ ๊ฐฏ์๋ฅผ ์ธ๋ ๋ฌธ์ ์ ๋๋ค.
import sys
input = sys.stdin.readline
n = int(input())
dp_fact = [1, 1, 2, 6] # 0! ~ 3!
for i in range(4, n+1):
dp_fact.append(dp_fact[i-1] * i)
str_num = str(dp_fact[n])
zero_count = 0
for i in range(len(str_num)-1, -1, -1):
if str_num[i] == '0':
zero_count += 1
else:
break
print(zero_count)
์ด์ ๋ฐฐ์ด DP๋ฅผ ํ์ฉํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐ ํ ์์์์ต๋๋ค.