結果
問題 | No.736 約比 |
ユーザー |
|
提出日時 | 2018-12-09 16:15:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 661 bytes |
コンパイル時間 | 1,443 ms |
コンパイル使用メモリ | 168,236 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 09:00:39 |
合計ジャッジ時間 | 2,908 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 65 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(obj) obj.begin(), obj.end() #define fcout cout << fixed using i64 = long long; i64 gcd(i64 a, i64 b) { if (a < b) { return gcd(b, a); } else if (b == 0) { return a; } else { return gcd(b, a % b); } } int main() { int N; cin >> N; vector<i64> a(N); REP(i, N) { cin >> a[i]; } i64 div = a[0]; FOR(i, 1, N) { div = gcd(div, a[i]); } REP(i, N) { cout << (i == 0 ? "" : ":") << a[i] / div; } cout << endl; }