結果
| 問題 |
No.736 約比
|
| コンテスト | |
| ユーザー |
momotaro1303
|
| 提出日時 | 2019-10-05 01:05:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 513 bytes |
| コンパイル時間 | 1,355 ms |
| コンパイル使用メモリ | 168,432 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-04 02:51:08 |
| 合計ジャッジ時間 | 3,108 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 65 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e18+7;
ll gcd(ll a,ll b){
if(a<b) swap(a,b);
if(a%b==0) return b;
else return gcd(a%b,b);
}
int N;
ll a[105];
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin>>N;
for(int i=0; i<N; i++){
cin>>a[i];
}
ll lcf=mod;
for(int i=0; i<N; i++){
for(int j=0; j<N; j++){
if(i!=j){
lcf=min(lcf,gcd(a[i],a[j]));
}
}
}
for(int i=0; i<N; i++){
if(i<N-1){
cout<<a[i]/lcf<<':';
}else{
cout<<a[i]/lcf<<endl;
}
}
}
momotaro1303