結果

問題 No.713 素数の和
ユーザー kobaya0514kobaya0514
提出日時 2018-07-13 22:31:25
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 220 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 7,956 KB
最終ジャッジ日時 2023-07-30 09:46:12
合計ジャッジ時間 929 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,764 KB
testcase_01 AC 17 ms
7,816 KB
testcase_02 AC 18 ms
7,804 KB
testcase_03 AC 16 ms
7,956 KB
testcase_04 AC 16 ms
7,904 KB
testcase_05 AC 16 ms
7,892 KB
testcase_06 AC 16 ms
7,852 KB
testcase_07 AC 16 ms
7,828 KB
testcase_08 AC 16 ms
7,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p=[0 for i in range(1001)]
p[0]=1
p[1]=1

for i in range(1001):
  if p[i]==0:
    cnt=2
    while cnt*i<1001:
      p[cnt*i]=1
      cnt+=1

N=int(input())

ans=0
for i in range(N+1):
  if p[i]==0:
    ans+=i
print(ans)
0