λ¬Έμ
https://www.acmicpc.net/problem/1676
1676λ²: ν©ν λ¦¬μΌ 0μ κ°μ
N!μμ λ€μμλΆν° μ²μ 0μ΄ μλ μ«μκ° λμ¬ λκΉμ§ 0μ κ°μλ₯Ό ꡬνλ νλ‘κ·Έλ¨μ μμ±νμμ€.
www.acmicpc.net
νμ΄
# λ°±μ€ 1676λ² λ¬Έμ - ν©ν λ¦¬μΌ 0μ κ°μ
from math import factorial
n = int(input())
num = list(str(factorial(n)))
cnt = 0
stack = []
for i in range(len(num)-1,0, -1):
if num[i] == '0':
cnt += 1
else:
break
print(cnt)
'ποΈ Algorithm > π© λ°±μ€' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
π© [λ°±μ€] [Python] Class3_1764λ²_λ£λ³΄μ‘ (0) | 2022.10.28 |
---|---|
π© [λ°±μ€] [Python] Class3_11723λ²_μ§ν© (0) | 2022.10.28 |
[λ°±μ€] [Python] Class2_15829λ²_Hashing (0) | 2022.10.27 |
[λ°±μ€] [Python] Class2_10866λ²_λ± (0) | 2022.10.27 |
[λ°±μ€] [Python] Class2_10816λ²_μ«μ μΉ΄λ2 (0) | 2022.10.27 |