結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー H3PO4H3PO4
提出日時 2020-07-23 09:29:06
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 367 ms / 1,000 ms
コード長 484 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 116,072 KB
最終ジャッジ日時 2023-09-05 22:03:11
合計ジャッジ時間 5,577 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,568 KB
testcase_01 AC 71 ms
71,820 KB
testcase_02 AC 70 ms
71,596 KB
testcase_03 AC 83 ms
77,632 KB
testcase_04 AC 74 ms
71,876 KB
testcase_05 AC 68 ms
71,612 KB
testcase_06 AC 73 ms
71,636 KB
testcase_07 AC 70 ms
71,488 KB
testcase_08 AC 70 ms
71,796 KB
testcase_09 AC 71 ms
71,876 KB
testcase_10 AC 69 ms
71,816 KB
testcase_11 AC 70 ms
71,308 KB
testcase_12 AC 70 ms
71,344 KB
testcase_13 AC 71 ms
71,856 KB
testcase_14 AC 73 ms
75,912 KB
testcase_15 AC 71 ms
71,304 KB
testcase_16 AC 70 ms
71,484 KB
testcase_17 AC 71 ms
71,684 KB
testcase_18 AC 72 ms
71,412 KB
testcase_19 AC 104 ms
80,916 KB
testcase_20 AC 157 ms
88,704 KB
testcase_21 AC 71 ms
71,968 KB
testcase_22 AC 71 ms
71,684 KB
testcase_23 AC 72 ms
71,820 KB
testcase_24 AC 71 ms
71,812 KB
testcase_25 AC 212 ms
96,524 KB
testcase_26 AC 70 ms
71,884 KB
testcase_27 AC 70 ms
71,332 KB
testcase_28 AC 69 ms
71,824 KB
testcase_29 AC 68 ms
71,776 KB
testcase_30 AC 70 ms
71,820 KB
testcase_31 AC 69 ms
71,648 KB
testcase_32 AC 141 ms
86,696 KB
testcase_33 AC 367 ms
116,072 KB
testcase_34 AC 356 ms
116,044 KB
testcase_35 AC 194 ms
94,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


N, L = map(int, input().split())
ans = 0
for d in primes(L // (N - 1) + 1):
    length = (N - 1) * d
    if length > L:
        break
    ans += L - length + 1
print(ans)
0