結果

問題 No.713 素数の和
ユーザー 双六双六
提出日時 2020-07-25 14:58:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 586 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 78,052 KB
最終ジャッジ日時 2023-09-09 13:16:17
合計ジャッジ時間 2,076 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
77,856 KB
testcase_01 AC 108 ms
77,832 KB
testcase_02 AC 107 ms
78,004 KB
testcase_03 AC 106 ms
77,804 KB
testcase_04 AC 105 ms
77,836 KB
testcase_05 AC 107 ms
78,052 KB
testcase_06 AC 106 ms
77,792 KB
testcase_07 AC 107 ms
77,832 KB
testcase_08 AC 106 ms
77,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

num = 10 ** 5 + 1 #適当に値を入れる
L = [1 for i in range(num)]; L[0] = 0; L[1] = 0
plist = []
for i in range(num):
	if L[i] == 1:
		plist.append(i); c = 2
		while i * c <= num - 1:
			L[i * c] = 0; c += 1

#処理内容
def main():
	N = int(input())
	ans = 0
	for i in plist:
		if i <= N:
			ans += i
		else:
			break

	print(ans)


if __name__ == '__main__':
	main()
0