結果
| 問題 | No.736 約比 | 
| コンテスト | |
| ユーザー |  merom686 | 
| 提出日時 | 2018-09-28 21:37:08 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 585 bytes | 
| コンパイル時間 | 732 ms | 
| コンパイル使用メモリ | 76,420 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-12 05:43:15 | 
| 合計ジャッジ時間 | 2,294 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 65 | 
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;
ll gcd(ll n, ll m) {
    if (n < m) swap(n, m);
    while (m != 0) {
        ll r = n % m;
        n = m;
        m = r;
    }
    return n;
}
int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    ll t = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        t = gcd(t, a[i]);
    }
    for (int i = 0; i < n; i++) {
        cout << a[i] / t << ":\n"[i == n - 1];
    }
    return 0;
}
            
            
            
        