結果
問題 | No.736 約比 |
ユーザー |
![]() |
提出日時 | 2020-02-08 04:47:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 480 bytes |
コンパイル時間 | 1,307 ms |
コンパイル使用メモリ | 69,800 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-25 08:41:24 |
合計ジャッジ時間 | 2,123 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 65 |
ソースコード
#include <iostream>#include <vector>using namespace std;long long gcd(long long a, long long b) {if (a == 0) return b;else return gcd(b % a, a);}int main(void) {int n;cin >> n;vector<long long> a(n);for (int i = 0; i < n; ++i) cin >> a[i];long long a_gcd = gcd(a[0], a[1]);for (int i = 1; i < n - 1; ++i) {a_gcd = gcd(a_gcd, a[i + 1]);}cout << a[0] / a_gcd;for (int i = 1; i < n; ++i) {cout << ':' << a[i] / a_gcd;}cout << endl;return 0;}