結果

問題 No.713 素数の和
ユーザー daleksprinterdaleksprinter
提出日時 2018-07-28 16:17:17
言語 Python2
(2.7.18)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 633 ms
コンパイル使用メモリ 6,700 KB
実行使用メモリ 6,532 KB
最終ジャッジ日時 2023-09-19 08:26:43
合計ジャッジ時間 1,047 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
6,500 KB
testcase_01 AC 13 ms
6,528 KB
testcase_02 AC 14 ms
6,332 KB
testcase_03 AC 12 ms
6,492 KB
testcase_04 AC 12 ms
6,512 KB
testcase_05 AC 12 ms
6,528 KB
testcase_06 AC 12 ms
6,532 KB
testcase_07 AC 13 ms
6,404 KB
testcase_08 AC 12 ms
6,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def mark(s, x):
    for i in xrange(x + x, len(s), x):
        s[i] = False

def sieve(n):
    s = [True] * n
    for x in xrange(2, int(n**0.5) + 1):
        if s[x]: mark(s, x)
    return [i for i in xrange(0,n) if s[i] and i > 1]


print sum(sieve(int(input())+1))
0