結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー 夜
提出日時 2021-07-22 04:14:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,001 bytes
コンパイル時間 714 ms
コンパイル使用メモリ 91,332 KB
実行使用メモリ 103,260 KB
最終ジャッジ日時 2023-09-24 20:25:35
合計ジャッジ時間 7,644 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long p[12] = { 2,3,5,7,11,13,17,19,23,29,31,37 };
int main() {
	int t;
	cin >> t;
	for (int i = 0; i < t; i++) {
		long long x, x1;
		cin >> x;
		long long ans = 100000000000000;
		int co[12] = {}, co1[12] = {};
		for (long long j = 2; j < 35; j++) {
			for (int k = 0; k < 12; k++) {
				x1 = x;
				co[k] = 1;
				while (x1 % p[k] == 0) {
					x1 /= p[k];
					co[k]++;
				}
			}
			for (int k = 0; k < 12; k++) {
				x1 = x * j;
				co1[k] = 1;
				while (x1 % p[k] == 0) {
					x1 /= p[k];
					co1[k]++;
				}
			}
			long long c = 1, c1 = 1;
			for (int k = 0; k < 12; k++) {
				c *= co[k];
				c1 *= co1[k];
			}
			if (c * 2 == c1) {
				ans = min(ans, x * j);
			}
		}
		cout << ans << endl;
	}
}
0