結果

問題 No.1657 Sum is Prime (Easy Version)
ユーザー huka_hukahuka_huka
提出日時 2021-08-28 20:59:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 500 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 81,992 KB
実行使用メモリ 278,820 KB
最終ジャッジ日時 2024-05-01 16:10:26
合計ジャッジ時間 23,970 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,608 KB
testcase_01 AC 37 ms
52,224 KB
testcase_02 TLE -
testcase_03 RE -
testcase_04 WA -
testcase_05 AC 35 ms
52,096 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 44 ms
62,592 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 49 ms
68,224 KB
testcase_12 TLE -
testcase_13 AC 1,038 ms
259,280 KB
testcase_14 AC 1,817 ms
259,720 KB
testcase_15 AC 1,880 ms
260,364 KB
testcase_16 AC 720 ms
218,944 KB
testcase_17 AC 898 ms
258,268 KB
testcase_18 AC 968 ms
258,052 KB
testcase_19 TLE -
testcase_20 AC 1,335 ms
259,076 KB
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left
def eratosthenes(s, t):
        Prime = []
        Data = [i+1 for i in range(1, t)]
        limit = t**0.5
        while True:
            p = Data[0]
            if p > limit:
                Prime += Data
                Prime = Prime[bisect_left(Prime, s):]
                return Prime
            Prime.append(p)
            Data = [e for e in Data if e%p != 0]
l, r = map(int, input().split())
P = eratosthenes(l, r)
P += eratosthenes(2*l+1, 2*r+1)
print(len(P))
0