結果
問題 | No.1611 Minimum Multiple with Double Divisors |
ユーザー | wolgnik |
提出日時 | 2021-07-21 23:18:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,553 ms / 2,000 ms |
コード長 | 1,871 bytes |
コンパイル時間 | 339 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 77,464 KB |
最終ジャッジ日時 | 2024-10-03 02:37:40 |
合計ジャッジ時間 | 28,501 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,553 ms
77,008 KB |
testcase_01 | AC | 1,402 ms
77,428 KB |
testcase_02 | AC | 1,395 ms
77,152 KB |
testcase_03 | AC | 1,386 ms
76,924 KB |
testcase_04 | AC | 1,389 ms
77,352 KB |
testcase_05 | AC | 1,375 ms
77,032 KB |
testcase_06 | AC | 1,401 ms
77,208 KB |
testcase_07 | AC | 1,409 ms
76,696 KB |
testcase_08 | AC | 1,395 ms
76,932 KB |
testcase_09 | AC | 1,403 ms
77,344 KB |
testcase_10 | AC | 990 ms
76,924 KB |
testcase_11 | AC | 1,019 ms
77,464 KB |
testcase_12 | AC | 999 ms
77,056 KB |
testcase_13 | AC | 1,000 ms
76,612 KB |
testcase_14 | AC | 996 ms
77,168 KB |
testcase_15 | AC | 991 ms
76,912 KB |
testcase_16 | AC | 1,012 ms
76,544 KB |
testcase_17 | AC | 997 ms
76,816 KB |
testcase_18 | AC | 1,020 ms
77,056 KB |
testcase_19 | AC | 103 ms
75,396 KB |
testcase_20 | AC | 87 ms
74,096 KB |
testcase_21 | AC | 98 ms
76,800 KB |
testcase_22 | AC | 86 ms
73,604 KB |
testcase_23 | AC | 92 ms
74,624 KB |
testcase_24 | AC | 95 ms
76,648 KB |
testcase_25 | AC | 91 ms
75,132 KB |
testcase_26 | AC | 96 ms
76,800 KB |
testcase_27 | AC | 97 ms
76,928 KB |
testcase_28 | AC | 48 ms
58,496 KB |
testcase_29 | AC | 43 ms
52,736 KB |
testcase_30 | AC | 47 ms
59,648 KB |
testcase_31 | AC | 49 ms
60,800 KB |
testcase_32 | AC | 47 ms
59,008 KB |
testcase_33 | AC | 48 ms
60,288 KB |
testcase_34 | AC | 47 ms
59,008 KB |
testcase_35 | AC | 48 ms
59,264 KB |
testcase_36 | AC | 49 ms
58,368 KB |
testcase_37 | AC | 46 ms
59,392 KB |
testcase_38 | AC | 48 ms
59,648 KB |
ソースコード
import sys input = sys.stdin.readline class sieve: def __init__(self, n): self.n = n self.sv = [1] * (n + 1) self.sv[0] = 0 self.sv[1] = 0 self.minp = [n] * (n + 1) for i in range(2, n + 1): if self.sv[i]: self.minp[i] = i for j in range(i * 2, n + 1, i): self.sv[j] = 0 self.minp[j] = min(self.minp[j], i) def isprime(self, x): if x > self.n: return False return self.sv[x] == 1 def factorize(self, x): if self.sv[x]: return [(x, 1)] res = [] while x > 1: p = self.minp[x] c = 0 while x % p == 0: x //= p c += 1 res.append((p, c)) return res def modlcm(self, a, mod): res = [0] * (self.n + 1) ex = set() for i in range(len(a)): f = self.factorize(a[i]) for j in f: if j > self.n: ex.add(j) continue res[j] = max(f.count(j), res[j]) rres = 1 for i in range(self.n + 1): if res[i] != 0: rres *= pow(i, res[i], mod) rres %= mod for i in ex: rres *= i rres %= mod return rres sv = sieve(10 ** 2) primes = [] for x in range(100): if sv.isprime(x): primes.append(x) for _ in range(int(input())): x = int(input()) res = 10 ** 15 for p in primes: if x % p: res = min(res, x * p) else: t = x c = 0 while t % p == 0: t //= p c += 1 res = min(res, x * p ** (c + 1)) #print(res, p, c) #print(res) for d in range(2, 33): z = 1. for p in primes: if p > d: break if d % p or x % p: continue cx = 0 cd = 0 t = x while t % p == 0: t //= p cx += 1 t = d while t % p == 0: t //= p cd += 1 z *= (cx + cd + 1) / (cx + 1) if z == 2.: res = min(res, x * d) print(res)