結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,272 KB
testcase_01 AC 33 ms
53,236 KB
testcase_02 RE -
testcase_03 AC 63 ms
67,356 KB
testcase_04 AC 34 ms
53,072 KB
testcase_05 AC 366 ms
135,864 KB
testcase_06 AC 197 ms
101,160 KB
testcase_07 AC 36 ms
52,444 KB
testcase_08 AC 35 ms
53,568 KB
testcase_09 AC 35 ms
52,668 KB
testcase_10 AC 36 ms
58,064 KB
testcase_11 AC 34 ms
52,992 KB
testcase_12 AC 39 ms
59,084 KB
testcase_13 AC 37 ms
58,664 KB
testcase_14 AC 42 ms
58,868 KB
testcase_15 AC 36 ms
52,524 KB
testcase_16 AC 37 ms
58,260 KB
testcase_17 AC 37 ms
59,232 KB
testcase_18 AC 38 ms
58,160 KB
testcase_19 AC 64 ms
68,412 KB
testcase_20 AC 127 ms
86,612 KB
testcase_21 AC 70 ms
70,312 KB
testcase_22 AC 64 ms
66,500 KB
testcase_23 AC 88 ms
75,108 KB
testcase_24 AC 112 ms
82,804 KB
testcase_25 AC 198 ms
104,772 KB
testcase_26 AC 185 ms
98,484 KB
testcase_27 AC 57 ms
64,248 KB
testcase_28 AC 91 ms
75,720 KB
testcase_29 AC 182 ms
96,624 KB
testcase_30 AC 59 ms
64,888 KB
testcase_31 AC 149 ms
89,804 KB
testcase_32 AC 198 ms
101,792 KB
testcase_33 AC 410 ms
149,824 KB
testcase_34 AC 405 ms
149,496 KB
testcase_35 AC 358 ms
138,244 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