結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー rlangevinrlangevin
提出日時 2023-01-14 00:27:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 361 ms / 1,000 ms
コード長 428 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 170,048 KB
最終ジャッジ日時 2023-08-26 05:34:25
合計ジャッジ時間 14,795 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 341 ms
169,940 KB
testcase_01 AC 348 ms
169,980 KB
testcase_02 AC 342 ms
169,828 KB
testcase_03 AC 342 ms
169,960 KB
testcase_04 AC 345 ms
169,708 KB
testcase_05 AC 341 ms
169,860 KB
testcase_06 AC 347 ms
169,976 KB
testcase_07 AC 346 ms
170,016 KB
testcase_08 AC 348 ms
169,696 KB
testcase_09 AC 354 ms
169,984 KB
testcase_10 AC 350 ms
169,824 KB
testcase_11 AC 351 ms
169,936 KB
testcase_12 AC 357 ms
169,728 KB
testcase_13 AC 351 ms
170,004 KB
testcase_14 AC 358 ms
169,932 KB
testcase_15 AC 346 ms
169,700 KB
testcase_16 AC 349 ms
169,828 KB
testcase_17 AC 361 ms
169,840 KB
testcase_18 AC 358 ms
170,024 KB
testcase_19 AC 357 ms
169,716 KB
testcase_20 AC 361 ms
169,792 KB
testcase_21 AC 347 ms
170,048 KB
testcase_22 AC 348 ms
169,876 KB
testcase_23 AC 352 ms
169,860 KB
testcase_24 AC 351 ms
169,624 KB
testcase_25 AC 360 ms
169,852 KB
testcase_26 AC 355 ms
169,928 KB
testcase_27 AC 348 ms
169,828 KB
testcase_28 AC 349 ms
169,880 KB
testcase_29 AC 346 ms
169,912 KB
testcase_30 AC 344 ms
169,956 KB
testcase_31 AC 344 ms
170,008 KB
testcase_32 AC 349 ms
169,840 KB
testcase_33 AC 347 ms
169,720 KB
testcase_34 AC 351 ms
170,008 KB
testcase_35 AC 355 ms
169,612 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)//2)
ans = 0
for s in S:
    ans += max(0, L - s * (N - 1) + 1)
print(ans)
0