結果
問題 | No.736 約比 |
ユーザー |
![]() |
提出日時 | 2019-12-04 07:05:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 490 bytes |
コンパイル時間 | 1,638 ms |
コンパイル使用メモリ | 168,340 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-29 12:07:23 |
合計ジャッジ時間 | 3,696 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 65 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=0;i<(n);++i)#define all(a) (a).begin(),(a).end()using namespace std;typedef long long ll;ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }int main() {ios::sync_with_stdio(false);cin.tie(0);int n;cin >> n;vector<ll> A(n);rep(i, n) cin >> A[i];ll k = gcd(A[0], A[1]);for (int i = 1; i < n; ++i) {k = gcd(k, A[i]);}rep(i, n) {cout << A[i] / k;if (i != n - 1) cout << ":";}cout << endl;return 0;}