結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー 👑 yumechiyumechi
提出日時 2016-08-26 00:30:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 559 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 82,500 KB
実行使用メモリ 151,432 KB
最終ジャッジ日時 2024-04-25 17:02:23
合計ジャッジ時間 5,183 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 37 ms
53,564 KB
testcase_02 AC 36 ms
52,720 KB
testcase_03 AC 65 ms
67,164 KB
testcase_04 AC 35 ms
53,336 KB
testcase_05 AC 372 ms
135,352 KB
testcase_06 AC 197 ms
100,728 KB
testcase_07 AC 35 ms
52,584 KB
testcase_08 AC 36 ms
53,716 KB
testcase_09 AC 35 ms
52,700 KB
testcase_10 AC 37 ms
58,104 KB
testcase_11 AC 35 ms
53,944 KB
testcase_12 AC 39 ms
59,576 KB
testcase_13 AC 38 ms
58,324 KB
testcase_14 AC 40 ms
58,696 KB
testcase_15 AC 36 ms
54,176 KB
testcase_16 AC 39 ms
59,016 KB
testcase_17 AC 40 ms
59,144 KB
testcase_18 AC 36 ms
59,144 KB
testcase_19 AC 65 ms
69,424 KB
testcase_20 AC 125 ms
87,416 KB
testcase_21 AC 69 ms
70,772 KB
testcase_22 AC 65 ms
68,028 KB
testcase_23 AC 86 ms
73,832 KB
testcase_24 AC 111 ms
82,500 KB
testcase_25 AC 203 ms
104,844 KB
testcase_26 AC 188 ms
98,972 KB
testcase_27 AC 56 ms
64,744 KB
testcase_28 AC 92 ms
77,468 KB
testcase_29 AC 184 ms
96,912 KB
testcase_30 AC 61 ms
65,812 KB
testcase_31 AC 151 ms
91,420 KB
testcase_32 AC 193 ms
101,376 KB
testcase_33 AC 405 ms
151,276 KB
testcase_34 AC 405 ms
151,432 KB
testcase_35 AC 359 ms
138,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt

def solve():
    n, l = map(int, input().split())
    ans = 0
    if l <= 5:
        print(0)
        return
    primes = [True for _ in range(l)]
    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