結果
問題 | No.736 約比 |
ユーザー |
![]() |
提出日時 | 2020-07-27 21:54:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 613 bytes |
コンパイル時間 | 1,596 ms |
コンパイル使用メモリ | 168,416 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 20:17:24 |
合計ジャッジ時間 | 3,329 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 65 |
ソースコード
#include <bits/stdc++.h> #define PI 3.14159265359 using namespace std; const int64_t MOD = 1e9 + 7; int64_t gcd(int64_t a, int64_t b) { int64_t n, m; n = max(a, b); m = min(a, b); if (!m) return n; while (1) { int64_t spl = n % m; if (spl) { n = m; m = spl; } else { return m; } } } int main() { int N; cin >> N; vector<int64_t> v(N); for (int i = 0; i < N; i++) { cin >> v.at(i); } int64_t d = 0; for (int i = 0; i < N; i++) { d = gcd(v.at(i), d); //cout << d << endl; } for (int i = 0; i < N; i++) { if (i) cout << ':'; cout << v.at(i) / d; } cout << endl; }