結果
問題 |
No.689 E869120 and Constructing Array 3
|
ユーザー |
![]() |
提出日時 | 2018-05-18 22:48:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 663 bytes |
コンパイル時間 | 1,746 ms |
コンパイル使用メモリ | 169,356 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 13:55:33 |
合計ジャッジ時間 | 3,841 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 7 |
ソースコード
#include<bits/stdc++.h> using namespace std; using Int = long long; Int isprime(Int x){ if(x<=1) return 0; for(Int i=2;i*i<=x;i++) if(x%i==0) return 0; return 1; } //INSERT ABOVE HERE signed main(){ vector<Int> ps; for(Int i=5;ps.size()<100u;i++) if(isprime(i)) ps.emplace_back(i); Int k; cin>>k; if(!k){ cout<<1<<endl<<1<<endl; return 0; } for(Int i=1;i<=100;i++){ if(k%i) continue; Int n=i+(k/i); if(n>250) continue; cout<<n<<endl; for(Int j=0;j<i;j++){ if(j) cout<<" "; cout<<ps[j]-2; } for(Int j=0;j<(k/i);j++) cout<<" "<<2; cout<<endl; return 0; } return 0; }