結果
| 問題 | No.736 約比 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-10 10:55:20 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 657 bytes |
| 記録 | |
| コンパイル時間 | 790 ms |
| コンパイル使用メモリ | 91,772 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-09 10:09:59 |
| 合計ジャッジ時間 | 2,535 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 65 |
ソースコード
#include <iostream>
#include <numeric>
#include <vector>
template <class T>
T gcd(T n, T m) {
while (m != 0) {
n %= m;
std::swap(n, m);
}
return n;
}
using lint = long long;
void solve() {
int n;
std::cin >> n;
std::vector<lint> xs(n);
for (auto& x : xs) std::cin >> x;
auto g = std::accumulate(xs.begin(), xs.end(), 0LL,
[](lint acc, lint x) { return gcd(acc, x); });
for (int i = 0; i < n; ++i) {
std::cout << xs[i] / g << ":\n"[i == n - 1];
}
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}