結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー 👑 yumechiyumechi
提出日時 2016-08-26 00:45:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 454 ms / 1,000 ms
コード長 586 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 114,608 KB
最終ジャッジ日時 2024-04-25 18:02:31
合計ジャッジ時間 4,352 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,632 KB
testcase_01 AC 37 ms
52,132 KB
testcase_02 AC 37 ms
53,304 KB
testcase_03 AC 53 ms
64,084 KB
testcase_04 AC 39 ms
53,240 KB
testcase_05 AC 37 ms
52,996 KB
testcase_06 AC 37 ms
52,444 KB
testcase_07 AC 36 ms
53,184 KB
testcase_08 AC 37 ms
52,624 KB
testcase_09 AC 36 ms
52,400 KB
testcase_10 AC 35 ms
51,880 KB
testcase_11 AC 36 ms
52,832 KB
testcase_12 AC 37 ms
53,728 KB
testcase_13 AC 37 ms
52,752 KB
testcase_14 AC 42 ms
59,276 KB
testcase_15 AC 36 ms
53,960 KB
testcase_16 AC 36 ms
52,216 KB
testcase_17 AC 37 ms
51,948 KB
testcase_18 AC 37 ms
53,352 KB
testcase_19 AC 67 ms
70,640 KB
testcase_20 AC 130 ms
85,332 KB
testcase_21 AC 37 ms
52,516 KB
testcase_22 AC 37 ms
53,024 KB
testcase_23 AC 36 ms
52,816 KB
testcase_24 AC 37 ms
52,668 KB
testcase_25 AC 228 ms
95,168 KB
testcase_26 AC 36 ms
52,952 KB
testcase_27 AC 36 ms
52,364 KB
testcase_28 AC 37 ms
52,180 KB
testcase_29 AC 37 ms
53,016 KB
testcase_30 AC 36 ms
52,268 KB
testcase_31 AC 37 ms
53,788 KB
testcase_32 AC 106 ms
79,892 KB
testcase_33 AC 453 ms
114,432 KB
testcase_34 AC 454 ms
114,608 KB
testcase_35 AC 206 ms
93,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n, l = map(int, input().split())
    ans = 0
    nummax = l // (n - 1) + 1
    if nummax < 2:
        print(0)
        return
    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