結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー H3PO4H3PO4
提出日時 2020-07-23 09:27:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 371 ms / 1,000 ms
コード長 476 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,364 KB
実行使用メモリ 115,848 KB
最終ジャッジ日時 2023-09-05 22:02:56
合計ジャッジ時間 5,620 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,552 KB
testcase_01 AC 74 ms
71,160 KB
testcase_02 AC 73 ms
71,176 KB
testcase_03 AC 85 ms
77,156 KB
testcase_04 AC 75 ms
71,152 KB
testcase_05 AC 74 ms
71,424 KB
testcase_06 AC 75 ms
71,580 KB
testcase_07 AC 75 ms
71,704 KB
testcase_08 AC 74 ms
71,512 KB
testcase_09 AC 73 ms
71,104 KB
testcase_10 AC 75 ms
71,148 KB
testcase_11 AC 75 ms
71,184 KB
testcase_12 AC 74 ms
71,036 KB
testcase_13 AC 75 ms
71,352 KB
testcase_14 AC 78 ms
75,568 KB
testcase_15 AC 74 ms
71,008 KB
testcase_16 AC 74 ms
71,404 KB
testcase_17 AC 73 ms
71,484 KB
testcase_18 AC 73 ms
71,428 KB
testcase_19 AC 108 ms
80,296 KB
testcase_20 AC 167 ms
88,320 KB
testcase_21 AC 74 ms
71,300 KB
testcase_22 AC 72 ms
71,556 KB
testcase_23 AC 74 ms
71,632 KB
testcase_24 AC 76 ms
71,624 KB
testcase_25 AC 222 ms
96,076 KB
testcase_26 AC 74 ms
71,412 KB
testcase_27 AC 75 ms
70,808 KB
testcase_28 AC 74 ms
71,396 KB
testcase_29 AC 73 ms
71,560 KB
testcase_30 AC 72 ms
71,532 KB
testcase_31 AC 73 ms
71,400 KB
testcase_32 AC 140 ms
86,144 KB
testcase_33 AC 371 ms
115,848 KB
testcase_34 AC 368 ms
115,564 KB
testcase_35 AC 211 ms
94,060 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):
    if (length := (N - 1) * d) > L:
        break
    ans += L - length + 1
print(ans)
0