結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー Example0911
提出日時 2021-07-21 21:45:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 662 bytes
コンパイル時間 1,655 ms
コンパイル使用メモリ 196,028 KB
最終ジャッジ日時 2025-01-23 03:40:05
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 28
権限があれば一括ダウンロードができます

ソースコード

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;


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 };
	int s = 12;
	int T; cin >> T;
	for (int _ = 0; _ < T; _++) {
		int X; cin >> X;
		int tmp = X;
		int ans = INF;
		for (int i = 0; i < s; i++) {
			int cnt = 1;
			while (X % a[i] == 0) {
				X /= a[i];
				cnt++;
			}
			int now = 1;
			for (int j = 0; j < cnt; j++)now *= a[i];
			ans = min(ans, now);
			X = tmp;
		}
		X *= ans;
		cout << X << endl;
	}
	return 0;


}

0