結果
| 問題 |
No.736 約比
|
| コンテスト | |
| ユーザー |
shiroha_F14
|
| 提出日時 | 2021-03-03 14:20:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 557 bytes |
| コンパイル時間 | 531 ms |
| コンパイル使用メモリ | 72,376 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-03 04:16:47 |
| 合計ジャッジ時間 | 2,272 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 40 WA * 25 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
using namespace std;
long long gcd(long long x, long long y){
while(y > 0){
long long r = x % y;
x = y;
y = r;
}
return x;
}
int main(){
int n; cin >> n; vector<long long> a(n);
for(int i = 0; i < n; i++) cin >> a[i];
int res = a[0];
for(int i = 1; i < n; i++){
res = gcd(res, a[i]);
}
string s = "";
for(int i = 0; i < n - 1; i++){s += to_string(a[i] / res) + ":";}
s += to_string(a[n - 1] / res);
cout << s << endl;
}
shiroha_F14