結果

問題 No.736 約比
ユーザー kappybar
提出日時 2020-04-14 12:54:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 168,596 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-01 16:56:57
合計ジャッジ時間 2,886 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 65
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll =  long long ;
using P = pair<int,int> ;
const int INF = 1e9;
const int MOD = 1000000007;

ll gcd(ll i,ll j){
        if(j == 0) return i;
        return gcd(j,i%j);
}

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll p = 0;
    rep(i,n) p = gcd(p,a[i]);
    rep(i,n){
        cout << a[i]/p << (i==n-1 ? '\n' : ':');
    }
    return 0;
}
0