結果

問題 No.713 素数の和
ユーザー _shota_224__shota_224_
提出日時 2018-07-13 22:36:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-17 11:13:55
合計ジャッジ時間 1,074 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
10,880 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 WA -
testcase_03 AC 34 ms
10,880 KB
testcase_04 AC 38 ms
10,752 KB
testcase_05 AC 32 ms
10,752 KB
testcase_06 AC 31 ms
10,880 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 31 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy
N = int(input())
sosu = [2]
nums = list(range(3,N+1,2))
while 1:
    tmp = copy.deepcopy(nums)
    if len(nums)==0:
        break
    sosu.append(nums[0])
    div = nums[0]
    for i in range(len(nums)):
        try:
            if nums[i]%div==0:
                nums.pop(i)
                i-=1
        except IndexError:
        	break
    if tmp==nums:
        break
if N==1:
    print(0)
elif N==2:
    print(1)
else:
    print(sum(sosu)+sum(nums))
0