목차

소수의 자격

ps
링크acmicpc.net/…
출처BOJ
문제 번호6219
문제명소수의 자격
레벨실버 3
분류

정수론

시간복잡도O(nloglogn)
인풋사이즈n<=4,000,000
사용한 언어Python
제출기록53792KB / 180ms
최고기록180ms
해결날짜2022/07/23

풀이

코드

"""Solution code for "BOJ 6219. 소수의 자격".

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

Tags: [Sieve]
"""

from teflib import numtheory


def main():
    A, B, D = [int(x) for x in input().split()]

    d_str = str(D)
    answer = 0
    for p in numtheory.prime_list(A, B):
        if d_str in str(p):
            answer += 1

    print(answer)


if __name__ == '__main__':
    main()
teflib.numtheory.prime_list