結果

問題 No.736 約比
ユーザー 👑 CleyL
提出日時 2020-01-24 02:11:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 544 ms
コンパイル使用メモリ 69,036 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 04:55:14
合計ジャッジ時間 2,410 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 65
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
long long gcd(long long a,long long b){
    if(a%b)return gcd(b,a%b);
    else return b;
}
int main(){
    int n;cin>>n;
    vector<long long> a(n);
    long long nw;
    for(int i = 0; n > i; i++){
        cin>>a[i];
        if(!i)nw = a[i];
        else nw = gcd(a[i],nw);
    }
    for(int i = 0; n > i; i++){
        cout << a[i]/nw;
        if(i+1 != n)cout << ":";
    }
    cout << endl;
}
0