結果
| 問題 | No.458 異なる素数の和 |
| コンテスト | |
| ユーザー |
こる
|
| 提出日時 | 2017-01-06 21:28:08 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 454 bytes |
| 記録 | |
| コンパイル時間 | 353 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 21,724 KB |
| 最終ジャッジ日時 | 2026-05-26 18:59:20 |
| 合計ジャッジ時間 | 6,943 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 16 WA * 3 RE * 9 |
ソースコード
import sys
n=int(input())
a=list(range(n+1))
a[1]=0
i=2
while i**2<=n:
j=i+i
while j<=n:
a[j]=0
j+=i
i+=1
list=[]
for i in a:
if i!=0:
list.append(i)
def fun(sum,index,target,count):
if sum==target:
print(count)
sys.exit()
return
if index==len(list) or sum>target:
return
fun(sum+list[index],index+1,target,count+1)
fun(sum,index+1,target,count)
print(fun(0,0,n,0))
こる