結果

問題 No.736 約比
ユーザー sggkshio
提出日時 2018-11-23 01:53:24
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 768 bytes
コンパイル時間 978 ms
コンパイル使用メモリ 84,328 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 18:01:59
合計ジャッジ時間 3,228 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 65
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
using namespace std;

//#include<bits/stdc++.h>

int main() {

	int n;
	cin >> n;
	long long int p=1,x;vector<long long int>w;
	for (int i = 0; i < n; i++) {
		cin >> x;
		w.push_back(x);
		long long int a = x;
		if (!i) {
			p = x; continue;
		}
		while (1) {
			if (a > p)swap(p, a);

			if (!a)break;

			p = p%a;
		}
		
	}

	for (int i = 0; i < n; i++)
	{
		if (i)cout << ":";
		cout << w[i] / p;
	}
	cout << endl;

	return 0;
}
0