結果
問題 |
No.736 約比
|
ユーザー |
![]() |
提出日時 | 2023-08-21 13:35:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 766 bytes |
コンパイル時間 | 1,080 ms |
コンパイル使用メモリ | 108,120 KB |
最終ジャッジ日時 | 2025-02-16 12:02:38 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 64 |
ソースコード
#include<iostream> #include<map> #include<vector> #include <algorithm> #include<math.h> #include <iomanip> #include<set> using namespace std; int main() { int n, ans = 1; cin >> n; vector<int> v(n); set<int> cand; for (int i = 0; i < n; i++) cin >> v[i]; for (int i = 2; i < v[0]; i++){ int t = v[0]; while (!(t%i)){ cand.insert(i); t /= i; } } for (auto itr = cand.begin(); itr != cand.end(); itr++){ int d = *itr; for (int j = 1; j < v.size(); j++){ if ((v[j]%d)) break; if (j == v.size() -1) ans = d; } } string delim = ""; for (auto x : v){ cout << delim << x/ans; delim = ":"; } cout << endl; }