結果

問題 No.736 約比
ユーザー tac
提出日時 2019-07-19 17:11:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 490 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 64,264 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-26 00:08:16
合計ジャッジ時間 2,066 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 58
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>

using namespace std;

template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int a[n];
    int tmp = 1;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if (i == 0) tmp = a[i];
        else tmp = gcd(tmp, a[i]);
    }
    for (int i = 0; i < n; ++i) {
        if (i) cout << ":";
        cout << a[i] / tmp;
    }
    cout << endl;
}
0