結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー htkbhtkb
提出日時 2018-05-27 13:08:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 352 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,572 KB
実行使用メモリ 431,680 KB
最終ジャッジ日時 2023-09-11 03:54:55
合計ジャッジ時間 6,551 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
15,068 KB
testcase_01 AC 17 ms
8,060 KB
testcase_02 AC 17 ms
7,972 KB
testcase_03 AC 54 ms
20,472 KB
testcase_04 AC 16 ms
7,932 KB
testcase_05 AC 17 ms
8,024 KB
testcase_06 AC 16 ms
7,900 KB
testcase_07 AC 16 ms
8,028 KB
testcase_08 AC 16 ms
8,068 KB
testcase_09 AC 16 ms
8,024 KB
testcase_10 AC 16 ms
8,024 KB
testcase_11 AC 17 ms
7,928 KB
testcase_12 AC 16 ms
7,920 KB
testcase_13 AC 16 ms
7,892 KB
testcase_14 AC 17 ms
8,408 KB
testcase_15 AC 16 ms
7,984 KB
testcase_16 AC 16 ms
7,900 KB
testcase_17 AC 16 ms
8,024 KB
testcase_18 AC 17 ms
7,932 KB
testcase_19 AC 201 ms
48,260 KB
testcase_20 AC 658 ms
146,132 KB
testcase_21 AC 16 ms
8,028 KB
testcase_22 AC 17 ms
7,972 KB
testcase_23 AC 16 ms
7,968 KB
testcase_24 AC 16 ms
7,892 KB
testcase_25 TLE -
testcase_26 AC 16 ms
8,024 KB
testcase_27 AC 16 ms
7,900 KB
testcase_28 AC 16 ms
7,928 KB
testcase_29 AC 16 ms
7,892 KB
testcase_30 AC 16 ms
7,976 KB
testcase_31 AC 17 ms
8,112 KB
testcase_32 AC 493 ms
112,296 KB
testcase_33 MLE -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt
N, L = map(int, input().split())
result = 0
max_interval = int(L//(N-1))

primes = set(range(2, max_interval+1))
du = primes.difference_update
du(range(4, max_interval+1, 2))
for i in range(3, int(sqrt(max_interval))+1, 2):
    du(range(i*2, max_interval+1, i))

for x in primes:
    d = x*(N-1)
    result += L-d+1

print(result)
0