結果

問題 No.713 素数の和
ユーザー pete1288998pete1288998
提出日時 2020-06-27 16:09:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 337 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 8,120 KB
最終ジャッジ日時 2023-09-19 04:15:39
合計ジャッジ時間 1,385 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import math

def get_prime(n):
    if n <= 1:
        return []
    prime = [2]    
    limit = int(math.sqrt(n))

    data = [i for i in range(3,n,2)]
    
    while limit > data[0]:
        prime.append(data[0])
        data = [i for i in data if i%data[0] != 0]

    return prime + data
    
n = int(input())

print(sum(get_prime(n)))
0