結果

問題 No.713 素数の和
ユーザー lam6er
提出日時 2025-03-20 20:18:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 59,512 KB
最終ジャッジ日時 2025-03-20 20:19:33
合計ジャッジ時間 1,145 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def is_prime(num):
    if num < 2:
        return False
    sqrt_num = int(math.sqrt(num)) + 1
    for d in range(2, sqrt_num):
        if num % d == 0:
            return False
    return True

n = int(input())
sum_primes = 0
for i in range(2, n + 1):
    if is_prime(i):
        sum_primes += i
print(sum_primes)
0