백준 1564번: 팩토리얼5 #Python

ColorlessDia·2025년 6월 14일

algorithm/baekjoon

목록 보기
573/808
N = int(input())

factorial = 1
divisor = 10 ** 13

for i in range(1, N + 1):
    factorial *= i
    
    while factorial % 10 == 0:
        factorial //= 10

    factorial %= divisor
    
print(str(factorial)[-5:])

0개의 댓글