結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー
提出日時 2021-07-22 04:30:14
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,231 ms / 2,000 ms
コード長 1,031 bytes
コンパイル時間 925 ms
コンパイル使用メモリ 92,508 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-03 02:49:19
合計ジャッジ時間 10,272 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

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[13] = { 2,3,5,7,11,13,17,19,23,29,31,37 };
int co[13] = {}, co1[35][13] = {};
int main() {
	for (int i = 2; i < 33; i++) {
		for (int j = 0; j < 12; j++) {
			int i1 = i;
			while (i1 % p[j] == 0) {
				i1 /= p[j];
				co1[i][j]++;
			}
		}
	}
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t;
	cin >> t;
	for (int i = 0; i < t; i++) {
		long long x, x1;
		cin >> x;
		for (long long j = 2; j < 33; j++) {
			for (int k = 0; k < 12; k++) {
				x1 = x;
				co[k] = 1;
				while (x1 % p[k] == 0) {
					x1 /= p[k];
					co[k]++;
				}
			}
			long long c = 1, c1 = 1;
			for (int k = 0; k < 12; k++) {
				c *= co[k];
				c1 *= co[k] + co1[j][k];
			}
			if (c * 2 == c1) {
				cout << x * j << endl;
				break;
			}
		}
	}
}
0