BOJ - 2553 - 마지막 팩토리얼 수

Updated:

def solution():
    N = int(input())

    num = 1
    for i in range(1, N+1):
        num *= i
        num %= 1000000000000
        while num % 10 == 0:
            num /= 10
    print(int(num % 10))

solution()

https://www.acmicpc.net/problem/2553

Categories:

Updated:

Leave a comment