結果

問題 No.407 鴨等素数間隔列の数え上げ
コンテスト
ユーザー 👑 yumechi
提出日時 2016-08-26 00:06:28
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 432 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,418 ms
コンパイル使用メモリ 82,532 KB
実行使用メモリ 246,476 KB
最終ジャッジ日時 2026-09-21 02:12:06
合計ジャッジ時間 12,110 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 11 WA * 3 TLE * 2 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from math import sqrt

def solve():
    n, l = map(int, input().split())
    ans = 0
    primes = ()
    i = 2
    while i < (l // (n - 2)):
        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