結果

問題 No.736 約比
ユーザー nii
提出日時 2018-09-28 22:19:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 896 ms
コンパイル使用メモリ 92,980 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 06:45:18
合計ジャッジ時間 2,316 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 65
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
using namespace std;
//
const int inf=1e9+7;//0x3f
//
long long gcd(long long a,long long b){
	if(b==0){
		return a;
	}else{
		return gcd(b,a%b);
	}
}
int main(){
	int N;
	long long A[100];
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	long long num=gcd(A[0],A[1]);
	for(int i=2;i<N;i++){
		num=gcd(num,A[i]);
	}
	for(int i=0;i<N;i++){
		if(i){
			cout<<":";
		}
		cout<<A[i]/num;
	}
	cout<<endl;
	return 0;
}
0