結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー rlangevinrlangevin
提出日時 2023-01-14 00:25:24
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 423 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 256,304 KB
最終ジャッジ日時 2023-08-26 05:33:16
合計ジャッジ時間 26,334 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 MLE -
testcase_04 AC 655 ms
255,880 KB
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 AC 731 ms
255,836 KB
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 AC 652 ms
255,872 KB
testcase_18 AC 736 ms
255,716 KB
testcase_19 AC 747 ms
255,944 KB
testcase_20 MLE -
testcase_21 MLE -
testcase_22 AC 749 ms
255,868 KB
testcase_23 MLE -
testcase_24 MLE -
testcase_25 MLE -
testcase_26 MLE -
testcase_27 MLE -
testcase_28 MLE -
testcase_29 MLE -
testcase_30 MLE -
testcase_31 MLE -
testcase_32 AC 751 ms
255,668 KB
testcase_33 MLE -
testcase_34 MLE -
testcase_35 AC 737 ms
255,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import *


def Sieve(n):
    lst = [True] * (n + 1)
    S = set()
    for i in range(2, ceil(sqrt(n)) + 1):
        if lst[i]:
            for j in range(2 * i, n + 1, i):
                lst[j] = False
    for i in range(2, n + 1):
        if lst[i]:
            S.add(i)
    return S


N, L = map(int, input().split())
S = Sieve(10 ** 7 + 5)
ans = 0
for s in S:
    ans += max(0, L - s * (N - 1) + 1)
print(ans)
0