結果
| 問題 | No.736 約比 | 
| コンテスト | |
| ユーザー |  ttttan | 
| 提出日時 | 2019-01-08 02:36:33 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 362 bytes | 
| コンパイル時間 | 1,448 ms | 
| コンパイル使用メモリ | 158,532 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-24 00:33:24 | 
| 合計ジャッジ時間 | 3,201 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 65 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int main(){
    ll n;cin>>n;
    ll a[n];for(ll i=0;i<n;i++)cin>>a[i];
    ll s=gcd(a[0],a[1]);
    for(ll i=2;i<n;i++)s=gcd(s,a[i]);
    for(ll i=0;i<n-1;i++)cout<<a[i]/s<<":";
    cout<<a[n-1]/s<<endl;
}
            
            
            
        