結果

問題 No.689 E869120 and Constructing Array 3
ユーザー beetbeet
提出日時 2018-05-18 22:48:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 663 bytes
コンパイル時間 1,703 ms
コンパイル使用メモリ 167,588 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-10 23:06:43
合計ジャッジ時間 4,114 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,376 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0