結果
| 問題 |
No.458 異なる素数の和
|
| コンテスト | |
| ユーザー |
紙ぺーぱー
|
| 提出日時 | 2016-12-08 02:31:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 354 bytes |
| コンパイル時間 | 1,708 ms |
| コンパイル使用メモリ | 166,544 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-28 04:14:11 |
| 合計ジャッジ時間 | 22,667 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}
紙ぺーぱー