結果

問題 No.713 素数の和
ユーザー DrDrpilotDrDrpilot
提出日時 2022-01-28 19:04:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,708 KB
実行使用メモリ 8,116 KB
最終ジャッジ日時 2023-08-28 16:55:15
合計ジャッジ時間 829 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import math
def isprime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        if n % i == 0: return False
    return True
n=int(input())
ans=0
for i in range(1,n+1):
    if isprime(i):
        ans+=i
print(ans)
0