結果

問題 No.713 素数の和
ユーザー lam6er
提出日時 2025-03-20 18:40:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 82,284 KB
実行使用メモリ 59,312 KB
最終ジャッジ日時 2025-03-20 18:40:14
合計ジャッジ時間 974 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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