結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー 👑 yumechiyumechi
提出日時 2016-08-26 00:49:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 229 ms / 1,000 ms
コード長 601 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 82,492 KB
実行使用メモリ 103,420 KB
最終ジャッジ日時 2024-05-09 10:59:13
合計ジャッジ時間 3,468 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,392 KB
testcase_01 AC 37 ms
54,360 KB
testcase_02 AC 37 ms
52,464 KB
testcase_03 AC 50 ms
66,820 KB
testcase_04 AC 36 ms
52,524 KB
testcase_05 AC 35 ms
53,340 KB
testcase_06 AC 35 ms
53,748 KB
testcase_07 AC 37 ms
53,712 KB
testcase_08 AC 34 ms
53,616 KB
testcase_09 AC 34 ms
52,788 KB
testcase_10 AC 34 ms
52,324 KB
testcase_11 AC 34 ms
52,960 KB
testcase_12 AC 34 ms
52,688 KB
testcase_13 AC 33 ms
52,804 KB
testcase_14 AC 39 ms
59,148 KB
testcase_15 AC 35 ms
52,584 KB
testcase_16 AC 34 ms
53,744 KB
testcase_17 AC 33 ms
52,348 KB
testcase_18 AC 34 ms
52,528 KB
testcase_19 AC 61 ms
77,360 KB
testcase_20 AC 101 ms
84,652 KB
testcase_21 AC 35 ms
53,756 KB
testcase_22 AC 36 ms
53,748 KB
testcase_23 AC 35 ms
53,452 KB
testcase_24 AC 34 ms
52,740 KB
testcase_25 AC 141 ms
90,468 KB
testcase_26 AC 35 ms
52,588 KB
testcase_27 AC 36 ms
53,204 KB
testcase_28 AC 37 ms
53,392 KB
testcase_29 AC 37 ms
52,368 KB
testcase_30 AC 36 ms
52,256 KB
testcase_31 AC 37 ms
52,648 KB
testcase_32 AC 92 ms
83,348 KB
testcase_33 AC 229 ms
103,412 KB
testcase_34 AC 229 ms
103,420 KB
testcase_35 AC 130 ms
90,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import array

def solve():
    n, l = map(int, input().split())
    ans = 0
    nummax = l // (n - 1) + 1
    if nummax < 2:
        print(0)
        return
    primes = array.array("B", (True for i 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
            taprime.append(i)

    for i in taprime:
        t = (l + 1) - (n - 1) * i
        if t <= 0:
            break
        ans += t
    print(ans)

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