結果

問題 No.3159 Just Answer 10 Integers!
ユーザー butsurizuki
提出日時 2025-05-04 01:28:30
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 2,703 ms
コンパイル使用メモリ 281,208 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-23 18:30:16
合計ジャッジ時間 3,257 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

// AC
#include<bits/stdc++.h>

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  std::random_device seed_gen;
  std::default_random_engine engine(seed_gen());

  vector<long long> p={1,2,3,5,7,11,13,17,19,23};
  int n;
  cin >> n;
  while(p.size()>n){p.pop_back();}
  long long v=1;
  for(auto &nx : p){ v*=nx; }

  std::uniform_int_distribution<> dist(1, 1000000000/v);
  v*=dist(engine);
  shuffle(p.begin(),p.end(),engine);
  for(auto &nx : p){
    cout << v/nx << " ";
  }
  return 0;
}
0