結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー 👑 yumechiyumechi
提出日時 2016-08-26 00:44:41
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 582 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,564 KB
実行使用メモリ 114,816 KB
最終ジャッジ日時 2024-04-25 18:02:10
合計ジャッジ時間 3,467 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,396 KB
testcase_01 AC 34 ms
52,572 KB
testcase_02 AC 33 ms
52,944 KB
testcase_03 AC 48 ms
63,692 KB
testcase_04 AC 34 ms
53,420 KB
testcase_05 AC 34 ms
52,872 KB
testcase_06 AC 35 ms
52,412 KB
testcase_07 AC 33 ms
53,308 KB
testcase_08 AC 35 ms
52,748 KB
testcase_09 AC 34 ms
52,544 KB
testcase_10 AC 33 ms
53,020 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 34 ms
53,132 KB
testcase_14 AC 38 ms
59,824 KB
testcase_15 RE -
testcase_16 AC 32 ms
53,216 KB
testcase_17 AC 35 ms
52,604 KB
testcase_18 AC 34 ms
52,992 KB
testcase_19 AC 62 ms
69,472 KB
testcase_20 AC 99 ms
84,760 KB
testcase_21 AC 34 ms
52,660 KB
testcase_22 AC 35 ms
52,528 KB
testcase_23 AC 34 ms
52,964 KB
testcase_24 AC 34 ms
52,872 KB
testcase_25 AC 181 ms
95,120 KB
testcase_26 AC 35 ms
53,076 KB
testcase_27 RE -
testcase_28 AC 34 ms
53,492 KB
testcase_29 AC 35 ms
53,004 KB
testcase_30 AC 34 ms
53,344 KB
testcase_31 AC 33 ms
53,936 KB
testcase_32 AC 88 ms
79,636 KB
testcase_33 AC 374 ms
114,816 KB
testcase_34 AC 376 ms
114,644 KB
testcase_35 AC 159 ms
93,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n, l = map(int, input().split())
    ans = 0
    if l <= 3:
        print(0)
        return
    nummax = l // (n - 1) + 1
    primes = [True for _ in range(nummax)]
    primes[0], primes[1] = False, False
    taprime = ()
    for i in range(2, nummax):
        if primes[i]:
            for j in range(2 * i, nummax, i):
                primes[j] = False

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

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