結果

問題 No.713 素数の和
ユーザー caleicalei
提出日時 2020-01-24 15:40:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 379 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,604 KB
実行使用メモリ 7,868 KB
最終ジャッジ日時 2023-10-12 04:09:19
合計ジャッジ時間 1,189 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

# yukicoder No.713 素数の和 2020/01/24

def sieve(n):
    end=int(pow(n,0.5))+1
    is_prime=[True]*(n+1)
    is_prime[0]=False
    is_prime[1]=False

    for i in range(2,end+1):
        if not is_prime[i]:continue
        for j in range(i*2,n+1,i):
            is_prime[j]=False
    return [i for i in range(n+1) if is_prime[i]]

n=int(input())
ans=sum(sieve(n))
print(ans)
0