結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー brthyyjpbrthyyjp
提出日時 2021-08-16 17:22:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 625 ms / 1,000 ms
コード長 508 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 186,880 KB
最終ジャッジ日時 2024-04-17 20:37:43
合計ジャッジ時間 8,011 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,096 KB
testcase_01 AC 40 ms
51,840 KB
testcase_02 AC 41 ms
52,096 KB
testcase_03 AC 87 ms
72,832 KB
testcase_04 AC 42 ms
52,224 KB
testcase_05 AC 593 ms
181,976 KB
testcase_06 AC 333 ms
126,464 KB
testcase_07 AC 41 ms
52,352 KB
testcase_08 AC 41 ms
52,096 KB
testcase_09 AC 41 ms
52,480 KB
testcase_10 AC 44 ms
57,472 KB
testcase_11 AC 40 ms
52,480 KB
testcase_12 AC 49 ms
59,264 KB
testcase_13 AC 47 ms
58,624 KB
testcase_14 AC 48 ms
59,264 KB
testcase_15 AC 41 ms
52,480 KB
testcase_16 AC 46 ms
58,496 KB
testcase_17 AC 45 ms
57,760 KB
testcase_18 AC 46 ms
57,984 KB
testcase_19 AC 90 ms
73,216 KB
testcase_20 AC 202 ms
99,968 KB
testcase_21 AC 101 ms
76,416 KB
testcase_22 AC 92 ms
73,600 KB
testcase_23 AC 136 ms
84,736 KB
testcase_24 AC 199 ms
99,200 KB
testcase_25 AC 318 ms
125,568 KB
testcase_26 AC 315 ms
124,288 KB
testcase_27 AC 75 ms
68,608 KB
testcase_28 AC 141 ms
87,552 KB
testcase_29 AC 308 ms
123,264 KB
testcase_30 AC 82 ms
70,528 KB
testcase_31 AC 259 ms
110,976 KB
testcase_32 AC 312 ms
124,672 KB
testcase_33 AC 625 ms
186,576 KB
testcase_34 AC 611 ms
186,880 KB
testcase_35 AC 557 ms
178,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, l = map(int, input().split())

import math

def sieve(n):
    ass = []
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, int(math.sqrt(n))+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    for i in range(n+1):
        if is_prime[i]:
            ass.append(i)
    return(ass)

S = sieve(l)
ans = 0
for d in S:
    if l-(n-1)*d < 0:
        break
    ans += l-(n-1)*d+1
print(ans)
0