結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー H3PO4H3PO4
提出日時 2020-07-23 09:35:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 613 ms / 1,000 ms
コード長 478 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 60,316 KB
最終ジャッジ日時 2023-12-12 21:54:37
合計ジャッジ時間 18,932 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 463 ms
42,756 KB
testcase_01 AC 449 ms
42,628 KB
testcase_02 AC 447 ms
42,628 KB
testcase_03 AC 451 ms
42,628 KB
testcase_04 AC 444 ms
42,628 KB
testcase_05 AC 446 ms
42,628 KB
testcase_06 AC 445 ms
42,628 KB
testcase_07 AC 448 ms
42,628 KB
testcase_08 AC 448 ms
42,628 KB
testcase_09 AC 454 ms
42,628 KB
testcase_10 AC 451 ms
42,628 KB
testcase_11 AC 457 ms
42,628 KB
testcase_12 AC 458 ms
42,628 KB
testcase_13 AC 454 ms
42,628 KB
testcase_14 AC 466 ms
42,628 KB
testcase_15 AC 458 ms
42,628 KB
testcase_16 AC 453 ms
42,628 KB
testcase_17 AC 454 ms
42,628 KB
testcase_18 AC 456 ms
42,628 KB
testcase_19 AC 469 ms
43,012 KB
testcase_20 AC 500 ms
46,212 KB
testcase_21 AC 448 ms
42,628 KB
testcase_22 AC 448 ms
42,628 KB
testcase_23 AC 450 ms
42,628 KB
testcase_24 AC 450 ms
42,628 KB
testcase_25 AC 534 ms
50,308 KB
testcase_26 AC 450 ms
42,628 KB
testcase_27 AC 451 ms
42,628 KB
testcase_28 AC 455 ms
42,628 KB
testcase_29 AC 453 ms
42,628 KB
testcase_30 AC 449 ms
42,628 KB
testcase_31 AC 452 ms
42,628 KB
testcase_32 AC 489 ms
44,676 KB
testcase_33 AC 605 ms
60,316 KB
testcase_34 AC 613 ms
60,316 KB
testcase_35 AC 567 ms
49,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np


def primes_np(n):
    is_prime = np.ones(n + 1, dtype=bool)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n ** 0.5) + 1):
        if not is_prime[i]:
            continue
        is_prime[i * 2:n + 1:i] = False
    return np.where(is_prime)[0].tolist()


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