結果
| 問題 | No.458 異なる素数の和 |
| コンテスト | |
| ユーザー |
紙ぺーぱー
|
| 提出日時 | 2016-12-08 02:31:08 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 354 bytes |
| 記録 | |
| コンパイル時間 | 964 ms |
| コンパイル使用メモリ | 180,152 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-22 07:49:29 |
| 合計ジャッジ時間 | 14,659 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 16 WA * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int n,dp[20050];
int main(){
scanf("%d\n",&n);
assert(1<=n&&n<=20000);
for(int i=2;i<20050;i++){
int ok=1;
for(int j=2;j<i;j++)if(i%j==0)ok=0;
if(ok)for(int j=20050-1;j>=i;j--)dp[j]=max(dp[j],dp[j-i]+1);
}
if(dp[n]<0)cout<<-1<<endl;
else cout<<dp[n]<<endl;
}
紙ぺーぱー