사용자 도구

사이트 도구


ps:problems:boj:9693

시파르

ps
링크acmicpc.net/…
출처BOJ
문제 번호9693
문제명시파르
레벨실버 4
분류

정수론

시간복잡도O(T*logn)
인풋사이즈T<=?, n<=10^6
사용한 언어Python 3.13
제출기록32412KB / 36ms
최고기록32ms
해결날짜2026/02/19

풀이

코드

"""Solution code for "BOJ 9693. 시파르".

- Problem link: https://www.acmicpc.net/problem/9693
- Solution link: http://www.teferi.net/ps/problems/boj/9693

Tags: [number theory]
"""

import sys
from teflib import psutils


def exponent_of_prime_in_factorial(n: int, p: int):
    """Compute largest power of a prime p that divides factorial(n)."""
    count = 0
    while n:
        n //= p
        count += n
    return count


@psutils.run_until_all_zero
@psutils.testcase_format('Case #{}: ')
def main():
    N = int(sys.stdin.readline())
    print(exponent_of_prime_in_factorial(N, 5))


if __name__ == '__main__':
    main()

토론

댓글을 입력하세요:
E Q C A E
 
ps/problems/boj/9693.txt · 마지막으로 수정됨: 2026/02/19 06:51 저자 teferi