結果
問題 | No.736 約比 |
ユーザー |
![]() |
提出日時 | 2021-02-07 21:41:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 557 bytes |
コンパイル時間 | 568 ms |
コンパイル使用メモリ | 71,556 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 15:02:45 |
合計ジャッジ時間 | 2,324 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 65 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; ll gcd(ll a , ll b){ if(a < b)swap(a , b); if(a % b == 0)return b; else return gcd(b , a % b); } int main(){ int n; cin >> n; vector<ll> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } ll g = a[0]; for(int i = 1; i < n; i++){ g = gcd(a[i] , g); } for(int i = 0; i < n; i++){ cout << a[i] / g; if(i != n - 1)cout << ":"; else cout << endl; } return 0; }