結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  constexpr array<int, 9> pr = { 2, 3, 5, 7, 11, 13, 17, 19, 23 };
  int x = 1;
  for (int p : pr) x *= p;
  int n;
  cin >> n;
  vector<int> ans(n);
  rep(i, n - 1) ans[i] = x / pr[i];
  ans[n - 1] = x;

  {
    set<ll> st;
    for (int x1 : ans) {
      for (int x2 : ans) {
        if (x1 == x2) continue;
        st.insert(lcm((ll) x1, (ll) x2));
      }
    }
    assert(st.size() == 1);
  }

  rep(i, n) cout << ans[i] << ' ';
  cout << '\n';
  return 0;
}
0