結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー 👑 yumechiyumechi
提出日時 2016-08-26 00:28:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 415 ms / 1,000 ms
コード長 522 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 150,424 KB
最終ジャッジ日時 2024-04-25 17:03:12
合計ジャッジ時間 7,591 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
135,424 KB
testcase_01 AC 122 ms
135,388 KB
testcase_02 AC 120 ms
135,840 KB
testcase_03 AC 146 ms
137,656 KB
testcase_04 AC 124 ms
136,220 KB
testcase_05 AC 373 ms
137,692 KB
testcase_06 AC 237 ms
137,936 KB
testcase_07 AC 121 ms
137,072 KB
testcase_08 AC 122 ms
136,112 KB
testcase_09 AC 122 ms
135,952 KB
testcase_10 AC 124 ms
136,368 KB
testcase_11 AC 124 ms
136,604 KB
testcase_12 AC 123 ms
136,340 KB
testcase_13 AC 122 ms
136,036 KB
testcase_14 AC 123 ms
136,680 KB
testcase_15 AC 124 ms
136,108 KB
testcase_16 AC 126 ms
137,312 KB
testcase_17 AC 127 ms
139,196 KB
testcase_18 AC 122 ms
137,936 KB
testcase_19 AC 144 ms
139,148 KB
testcase_20 AC 180 ms
141,504 KB
testcase_21 AC 141 ms
136,908 KB
testcase_22 AC 137 ms
136,328 KB
testcase_23 AC 152 ms
137,008 KB
testcase_24 AC 171 ms
136,956 KB
testcase_25 AC 241 ms
143,672 KB
testcase_26 AC 226 ms
137,332 KB
testcase_27 AC 133 ms
137,736 KB
testcase_28 AC 158 ms
137,912 KB
testcase_29 AC 230 ms
138,636 KB
testcase_30 AC 137 ms
137,364 KB
testcase_31 AC 205 ms
137,216 KB
testcase_32 AC 232 ms
141,220 KB
testcase_33 AC 412 ms
150,252 KB
testcase_34 AC 415 ms
150,424 KB
testcase_35 AC 376 ms
144,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt

def solve():
    n, l = map(int, input().split())
    ans = 0
    primes = [True for _ in range(10 ** 7 + 1)]
    primes[0], primes[1] = False, False
    for i in range(2, int(sqrt(l)) + 1):
        if primes[i]:
            for j in range(2, l // i - 1):
                primes[i * j] = False

    for i in range(2, l):
        if primes[i]:
            t = (l + 1) - (n - 1) * i
            if t <= 0:
                break
            ans += t
    print(ans)

if __name__=="__main__":
    solve()
0