結果

問題 No.736 約比
ユーザー dgd1724dgd1724
提出日時 2018-11-25 18:01:03
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 898 bytes
コンパイル時間 1,069 ms
コンパイル使用メモリ 71,924 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-08-26 05:11:36
合計ジャッジ時間 10,946 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,608 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 19 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,504 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 35 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 5 ms
4,380 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 1 ms
4,376 KB
testcase_41 AC 1 ms
4,376 KB
testcase_42 TLE -
testcase_43 AC 863 ms
4,376 KB
testcase_44 AC 265 ms
4,376 KB
testcase_45 AC 749 ms
4,380 KB
testcase_46 TLE -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>

int main() {

	//std::ifstream inf("Text.txt");	std::cin.rdbuf(inf.rdbuf());

	int N = 0;
	std::cin >> N;

	std::vector<long long int> a(N);
	for (int i = 0; i < N; i++) {
		std::cin >> a[i];
	}

	long long int min = *std::min_element(a.begin(), a.end());
	std::vector<long long int> b;
	for (int i = 1; i <= min / i; i++) {
		if (min % i == 0) {
			b.push_back(i);
			b.push_back(min / i);
		}
	}
	std::sort(b.rbegin(), b.rend());

	bool flg = false;
	for (unsigned int i = 0; i < b.size(); i++) {
		flg = true;
		for (int j = 0; j < N; j++) {
			if (a[j] % b[i] != 0) {
				flg = false;
				break;
			}
		}
		if (flg) {
			for (int k = 0; k < N; k++) {
				a[k] = a[k] / b[i];
			}
			break;
		}
	}

	for (int i = 0; i < N - 1; i++) {
		std::cout << a[i] << ":";
	}
	std::cout << a[N - 1] << std::endl;

	return 0;

}
0