結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー 👑 ygussanyygussany
提出日時 2021-05-22 15:49:49
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 719 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 30,848 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 05:09:05
合計ジャッジ時間 4,446 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 221 ms
6,812 KB
testcase_01 AC 96 ms
6,944 KB
testcase_02 AC 96 ms
6,944 KB
testcase_03 AC 97 ms
6,944 KB
testcase_04 AC 96 ms
6,940 KB
testcase_05 AC 96 ms
6,944 KB
testcase_06 AC 98 ms
6,940 KB
testcase_07 AC 99 ms
6,940 KB
testcase_08 AC 97 ms
6,940 KB
testcase_09 AC 97 ms
6,944 KB
testcase_10 AC 54 ms
6,944 KB
testcase_11 AC 59 ms
6,940 KB
testcase_12 AC 59 ms
6,944 KB
testcase_13 AC 59 ms
6,944 KB
testcase_14 AC 59 ms
6,940 KB
testcase_15 AC 59 ms
6,940 KB
testcase_16 AC 59 ms
6,940 KB
testcase_17 AC 59 ms
6,940 KB
testcase_18 AC 59 ms
6,944 KB
testcase_19 AC 1 ms
6,940 KB
testcase_20 AC 1 ms
6,940 KB
testcase_21 AC 1 ms
6,944 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 1 ms
6,940 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 1 ms
6,940 KB
testcase_26 AC 1 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 1 ms
6,948 KB
testcase_29 AC 1 ms
6,944 KB
testcase_30 AC 1 ms
6,940 KB
testcase_31 AC 1 ms
6,940 KB
testcase_32 AC 1 ms
6,944 KB
testcase_33 AC 1 ms
6,944 KB
testcase_34 AC 1 ms
6,940 KB
testcase_35 AC 0 ms
6,944 KB
testcase_36 AC 1 ms
6,940 KB
testcase_37 AC 1 ms
6,940 KB
testcase_38 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

const int prime[11] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31};

long long solve(long long X)
{
	int i, m[11];
	long long x;
	for (i = 0, x = X; i <= 10; i++) for (m[i] = 0; x % prime[i] == 0; m[i]++) x /= prime[i];
	
	int j, k, l[11], tmp[2];
	for (k = 2; k <= 30; k++) {
		for (i = 0, j = k; i <= 10; i++) for (l[i] = 0; j % prime[i] == 0; l[i]++) j /= prime[i];
		for (i = 0, tmp[0] = 1, tmp[1] = 1; i <= 10; i++) {
			tmp[0] *= m[i] + 1;
			tmp[1] *= m[i] + l[i] + 1;
		}
		if (tmp[1] == tmp[0] * 2) break;
	}
	return X * k;
}

int main()
{
	int t, T;
	long long X;
	scanf("%d", &T);
	for (t = 1; t <= T; t++) {
		scanf("%lld", &X);
		printf("%lld\n", solve(X));
	}
	fflush(stdout);
	return 0;
}
0