結果
| 問題 |
No.1611 Minimum Multiple with Double Divisors
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-21 21:49:42 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,007 bytes |
| コンパイル時間 | 911 ms |
| コンパイル使用メモリ | 114,428 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-22 11:49:46 |
| 合計ジャッジ時間 | 4,896 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 WA * 28 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;
void main() {
auto T = readln.chomp.to!int;
long[] P;
auto table = new bool[](10^^6);
for (long i = 2; i * i <= 10L^^11; ++i) {
if (table[i.to!int]) continue;
P ~= i;
for (long j = i * 2; j * j <= 10L ^^ 11; j += i) {
table[j.to!int] = true;
}
}
while (T--) {
auto X = readln.chomp.to!long;
long ans = 1L << 59;
foreach (i; 0..P.length.to!int) {
if (X % P[i] != 0) {
writeln(min(ans, X * P[i]));
break;
} else {
long count = 0;
long Y = X;
while (Y % P[i] == 0) {
Y /= P[i];
count += 1;
}
ans = min(ans, X * P[i]^^(count+1));
}
}
}
}