結果

問題 No.713 素数の和
ユーザー pofpof
提出日時 2019-07-16 14:42:54
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
RE  
実行時間 -
コード長 243 bytes
コンパイル時間 809 ms
コンパイル使用メモリ 10,764 KB
実行使用メモリ 8,316 KB
最終ジャッジ日時 2023-08-20 12:35:29
合計ジャッジ時間 1,793 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,252 KB
testcase_01 RE -
testcase_02 AC 16 ms
8,076 KB
testcase_03 AC 17 ms
8,316 KB
testcase_04 AC 16 ms
8,188 KB
testcase_05 AC 17 ms
8,128 KB
testcase_06 AC 16 ms
8,196 KB
testcase_07 AC 16 ms
8,128 KB
testcase_08 AC 17 ms
8,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = {i for i in range(2, n+1)}
import math
q=set()
while True:
    p=sorted(list(a.difference(q)))[0]
    if p > int(math.sqrt(n)):
        break
    q.add(p)
    for i in range(2,n//p+1):
        a.discard(p*i)
print(sum(a))
0