結果
| 問題 |
No.736 約比
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-08 23:02:35 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 661 bytes |
| コンパイル時間 | 1,611 ms |
| コンパイル使用メモリ | 167,956 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 14:29:03 |
| 合計ジャッジ時間 | 3,534 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 58 |
ソースコード
#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;
int gcd(int a, int 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<int> a(N);
REP(i, N) { cin >> a[i]; }
int div = a[0];
FOR(i, 1, N) {
div = gcd(div, a[i]);
}
REP(i, N) {
cout << (i == 0 ? "" : ":") << a[i] / div;
}
cout << endl;
}