結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー eitahoeitaho
提出日時 2016-08-07 03:09:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 583 ms / 1,000 ms
コード長 265 bytes
コンパイル時間 768 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 152,192 KB
最終ジャッジ日時 2024-04-24 19:42:39
合計ジャッジ時間 6,082 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,456 KB
testcase_01 AC 36 ms
51,584 KB
testcase_02 AC 37 ms
51,456 KB
testcase_03 AC 69 ms
68,224 KB
testcase_04 AC 37 ms
51,584 KB
testcase_05 AC 180 ms
131,968 KB
testcase_06 AC 96 ms
98,560 KB
testcase_07 AC 39 ms
51,968 KB
testcase_08 AC 38 ms
52,096 KB
testcase_09 AC 37 ms
52,096 KB
testcase_10 AC 40 ms
51,456 KB
testcase_11 AC 38 ms
51,456 KB
testcase_12 AC 38 ms
51,968 KB
testcase_13 AC 44 ms
57,728 KB
testcase_14 AC 46 ms
58,624 KB
testcase_15 AC 37 ms
51,712 KB
testcase_16 AC 42 ms
57,600 KB
testcase_17 AC 41 ms
57,216 KB
testcase_18 AC 42 ms
57,600 KB
testcase_19 AC 77 ms
69,632 KB
testcase_20 AC 147 ms
87,680 KB
testcase_21 AC 48 ms
62,080 KB
testcase_22 AC 46 ms
60,032 KB
testcase_23 AC 75 ms
72,576 KB
testcase_24 AC 70 ms
81,280 KB
testcase_25 AC 260 ms
106,240 KB
testcase_26 AC 94 ms
96,640 KB
testcase_27 AC 44 ms
57,344 KB
testcase_28 AC 62 ms
74,368 KB
testcase_29 AC 108 ms
95,616 KB
testcase_30 AC 44 ms
58,624 KB
testcase_31 AC 109 ms
88,832 KB
testcase_32 AC 258 ms
101,888 KB
testcase_33 AC 577 ms
152,192 KB
testcase_34 AC 583 ms
151,296 KB
testcase_35 AC 500 ms
136,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, L = map(int, input().split())
prime = [1] * (L + 1)
ans = 0

for p in range(2, L + 1):
    num = L - p * (N - 1) + 1
    if num <= 0:
        break
    if prime[p]:
        ans += num
        for i in range(p + p, L + 1, p):
            prime[i] = 0

print(ans)
0