結果

問題 No.3045 反復重み付き累積和
ユーザー gew1fw
提出日時 2025-06-12 18:19:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 82,640 KB
実行使用メモリ 153,984 KB
最終ジャッジ日時 2025-06-12 18:19:44
合計ジャッジ時間 9,281 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other WA * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def sieve(n):
    sieve = [True] * (n + 1)
    sieve[0] = sieve[1] = False
    for i in range(2, int(n ** 0.5) + 1):
        if sieve[i]:
            sieve[i*i : n+1 : i] = [False] * len(sieve[i*i : n+1 : i])
    primes = [i for i, is_prime in enumerate(sieve) if is_prime]
    return primes

# Generate primes up to 2e6 to cover the first 1e5 primes
primes = sieve(2000000)

N, M = map(int, sys.stdin.readline().split())

if M > len(primes):
    print(0)
else:
    p = primes[M - 1]
    print(N // p)
0