結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー ronpooronpoo
提出日時 2023-10-30 13:05:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 226 ms / 1,000 ms
コード長 467 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 158,568 KB
最終ジャッジ日時 2023-10-30 13:05:44
合計ジャッジ時間 4,245 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
53,828 KB
testcase_01 AC 34 ms
53,828 KB
testcase_02 AC 35 ms
53,828 KB
testcase_03 AC 47 ms
64,276 KB
testcase_04 AC 34 ms
53,828 KB
testcase_05 AC 34 ms
53,828 KB
testcase_06 AC 38 ms
53,828 KB
testcase_07 AC 34 ms
53,828 KB
testcase_08 AC 34 ms
53,828 KB
testcase_09 AC 34 ms
53,828 KB
testcase_10 AC 35 ms
53,828 KB
testcase_11 AC 35 ms
53,828 KB
testcase_12 AC 34 ms
53,828 KB
testcase_13 AC 36 ms
53,828 KB
testcase_14 AC 40 ms
59,632 KB
testcase_15 AC 38 ms
53,828 KB
testcase_16 AC 36 ms
53,828 KB
testcase_17 AC 35 ms
53,828 KB
testcase_18 AC 35 ms
53,828 KB
testcase_19 AC 59 ms
71,452 KB
testcase_20 AC 90 ms
90,268 KB
testcase_21 AC 35 ms
53,828 KB
testcase_22 AC 38 ms
53,828 KB
testcase_23 AC 35 ms
53,828 KB
testcase_24 AC 35 ms
53,828 KB
testcase_25 AC 127 ms
110,168 KB
testcase_26 AC 34 ms
53,828 KB
testcase_27 AC 35 ms
53,828 KB
testcase_28 AC 34 ms
53,828 KB
testcase_29 AC 34 ms
53,828 KB
testcase_30 AC 34 ms
53,828 KB
testcase_31 AC 35 ms
53,828 KB
testcase_32 AC 76 ms
86,232 KB
testcase_33 AC 226 ms
158,568 KB
testcase_34 AC 226 ms
158,568 KB
testcase_35 AC 139 ms
106,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, L = map(int, input().split())

def prime(x):
    prime = [x if x%2==1 else 2 for x in range(x+1)]
    prime[0] = 1

    for i in range(3, int(x**0.5)+2, 2):
        if prime[i] != i:
            continue   
        for j in range(2*i, x+1, i):
            if prime[j] == j:
                prime[j] = i

    p = {i for i in range(2, x+1) if prime[i] == i}
    return p

ans = 0
P = prime(L//(N-1)+10)
for p in P:
    a = max(0, L+1-(N-1)*p)
    ans += a
print(ans)
0