結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー yumechiyumechi
提出日時 2016-08-26 00:26:46
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 512 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 149,376 KB
最終ジャッジ日時 2024-11-08 04:11:29
合計ジャッジ時間 6,708 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,224 KB
testcase_01 AC 42 ms
51,840 KB
testcase_02 RE -
testcase_03 AC 79 ms
66,560 KB
testcase_04 AC 42 ms
51,968 KB
testcase_05 AC 477 ms
134,016 KB
testcase_06 AC 269 ms
99,584 KB
testcase_07 AC 43 ms
51,968 KB
testcase_08 AC 43 ms
51,840 KB
testcase_09 AC 43 ms
52,096 KB
testcase_10 AC 46 ms
57,344 KB
testcase_11 AC 42 ms
51,968 KB
testcase_12 AC 49 ms
58,112 KB
testcase_13 AC 48 ms
57,728 KB
testcase_14 AC 49 ms
58,112 KB
testcase_15 AC 43 ms
51,968 KB
testcase_16 AC 46 ms
57,344 KB
testcase_17 AC 50 ms
58,880 KB
testcase_18 AC 47 ms
57,472 KB
testcase_19 AC 82 ms
67,840 KB
testcase_20 AC 179 ms
86,272 KB
testcase_21 AC 93 ms
68,608 KB
testcase_22 AC 79 ms
66,304 KB
testcase_23 AC 112 ms
73,728 KB
testcase_24 AC 167 ms
81,792 KB
testcase_25 AC 275 ms
104,192 KB
testcase_26 AC 264 ms
97,536 KB
testcase_27 AC 68 ms
63,360 KB
testcase_28 AC 126 ms
75,264 KB
testcase_29 AC 257 ms
96,384 KB
testcase_30 AC 73 ms
64,384 KB
testcase_31 AC 210 ms
89,728 KB
testcase_32 AC 266 ms
100,480 KB
testcase_33 AC 537 ms
148,992 KB
testcase_34 AC 544 ms
149,376 KB
testcase_35 AC 472 ms
136,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt

def solve():
    n, l = map(int, input().split())
    ans = 0
    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