結果

問題 No.736 約比
コンテスト
ユーザー yansi819
提出日時 2024-03-30 11:45:54
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WJ  
(最新)
AC  
(最初)
実行時間 -
コード長 483 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
最終ジャッジ日時 2026-07-04 07:43:51
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;

ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  int n; cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  ll g = gcd(a[0], a[1]);
  for (int i = 2; i < n; i++) {
    g = gcd(g, a[i]);
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] / g << ":\n"[i == n - 1];
  }
  return 0;
}
0