結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー Example0911Example0911
提出日時 2021-07-21 22:05:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 470 ms / 2,000 ms
コード長 997 bytes
コンパイル時間 2,473 ms
コンパイル使用メモリ 203,388 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 05:17:26
合計ジャッジ時間 9,673 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 470 ms
6,816 KB
testcase_01 AC 239 ms
6,940 KB
testcase_02 AC 236 ms
6,944 KB
testcase_03 AC 240 ms
6,940 KB
testcase_04 AC 244 ms
6,944 KB
testcase_05 AC 237 ms
6,940 KB
testcase_06 AC 240 ms
6,940 KB
testcase_07 AC 237 ms
6,944 KB
testcase_08 AC 239 ms
6,944 KB
testcase_09 AC 237 ms
6,944 KB
testcase_10 AC 177 ms
6,944 KB
testcase_11 AC 184 ms
6,944 KB
testcase_12 AC 188 ms
6,940 KB
testcase_13 AC 191 ms
6,940 KB
testcase_14 AC 187 ms
6,940 KB
testcase_15 AC 187 ms
6,940 KB
testcase_16 AC 188 ms
6,944 KB
testcase_17 AC 191 ms
6,940 KB
testcase_18 AC 186 ms
6,944 KB
testcase_19 AC 4 ms
6,944 KB
testcase_20 AC 4 ms
6,940 KB
testcase_21 AC 3 ms
6,944 KB
testcase_22 AC 4 ms
6,940 KB
testcase_23 AC 3 ms
6,944 KB
testcase_24 AC 4 ms
6,940 KB
testcase_25 AC 4 ms
6,944 KB
testcase_26 AC 4 ms
6,940 KB
testcase_27 AC 3 ms
6,940 KB
testcase_28 AC 2 ms
6,944 KB
testcase_29 AC 1 ms
6,940 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 2 ms
6,940 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 AC 2 ms
6,944 KB
testcase_35 AC 1 ms
6,944 KB
testcase_36 AC 2 ms
6,940 KB
testcase_37 AC 2 ms
6,944 KB
testcase_38 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define int long long

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 61);
ll mod = 1000000007;
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	vector<int> a = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41 };
	int s = 13;
	int T; cin >> T;
	for (int _ = 0; _ < T; _++) {
		int X; cin >> X;
		int t = X;
		vector<int>c(45);
		for (int i = 0; i < s; i++) {
			int cnt = 0;
			while (X % a[i] == 0) {
				X /= a[i];
				cnt++;
			}
			c[a[i]] = cnt;
			X = t;
		}
		for (int i = 2; i <= 40; i++) {
			auto p = prime_factor(i);
			int a = 1, b = 1;
			for (auto x : p) {
				int cnt = c[x.first] + 1;
				a *= cnt;
				cnt += x.second;
				b *= cnt;
			}
			if (a * 2 == b) {
				cout << X * i << endl; break;
			}
		}
	}
	return 0;


}

0