結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー 👑 yumechiyumechi
提出日時 2016-08-26 00:09:24
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 436 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 82,628 KB
実行使用メモリ 85,592 KB
最終ジャッジ日時 2024-04-25 17:00:11
合計ジャッジ時間 5,111 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
59,252 KB
testcase_01 AC 34 ms
52,400 KB
testcase_02 AC 35 ms
53,392 KB
testcase_03 TLE -
testcase_04 AC 35 ms
52,400 KB
testcase_05 AC 35 ms
53,328 KB
testcase_06 AC 36 ms
53,876 KB
testcase_07 AC 36 ms
52,316 KB
testcase_08 AC 35 ms
52,164 KB
testcase_09 AC 36 ms
52,012 KB
testcase_10 AC 35 ms
53,276 KB
testcase_11 AC 33 ms
53,532 KB
testcase_12 AC 34 ms
52,456 KB
testcase_13 AC 35 ms
51,956 KB
testcase_14 AC 40 ms
59,292 KB
testcase_15 AC 35 ms
53,068 KB
testcase_16 AC 36 ms
52,336 KB
testcase_17 AC 35 ms
52,424 KB
testcase_18 AC 35 ms
53,400 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt

def solve():
    n, l = map(int, input().split())
    ans = 0
    primes = ()
    i = 2
    while i < (l // (n - 2) + 1):
        for j in primes:
            if i % j == 0:
                break
        else:
            primes = primes + (i,)
            if (l + 1) < (n - 1) * i:
                break
            ans += (l + 1) - (n - 1) * i
        i += 1
    print(ans)

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