結果
問題 | No.736 約比 |
ユーザー |
|
提出日時 | 2020-06-18 22:14:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 477 bytes |
コンパイル時間 | 1,581 ms |
コンパイル使用メモリ | 169,896 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-03 13:01:04 |
合計ジャッジ時間 | 3,106 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 65 |
ソースコード
#include <bits/stdc++.h>#define _GLIBCXX_DEBUG#define rep(i,n) for(int i=0; i<(n); i++)using namespace std;typedef long long ll;ll gcd(ll x, ll y){ll mx=max(x,y); ll mn=min(x,y); ll r;while(1){r=mx%mn;if(r==0) break;mx=mn; mn=r;}return mn;}int main(){int n; cin>>n;vector<ll> v(n);rep(i,n) cin>>v[i];ll ans=gcd(v[0],v[1]);for(int i=2; i<n; i++){ans=gcd(ans,v[i]);}rep(i,n){if(i) cout << ":";cout << v[i]/ans;}cout << endl;}