結果
| 問題 | No.1611 Minimum Multiple with Double Divisors |
| コンテスト | |
| ユーザー |
FromBooska
|
| 提出日時 | 2023-08-11 18:08:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,068 bytes |
| 記録 | |
| コンパイル時間 | 316 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 77,504 KB |
| 最終ジャッジ日時 | 2024-11-18 12:08:48 |
| 合計ジャッジ時間 | 8,949 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 29 |
ソースコード
# Xを素因数分解
# 既存素因数のべき乗を倍にするか、ない素因数を加える
# 10**11ということは37までに存在しない素因数があるはず
# 2*3*5*7*11*13*17*19*23*29*31*37 = 7*10**12
# いや、Xを素因数分解すると間に合わないだろう
# 必要なのは37までの素因数の有無
T = int(input())
for t in range(T):
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41]
X = int(input())
ans_multiple = 41
for p in primes:
c = 0
x = X
while x%p == 0:
x //= p
c += 1
if c == 0:
ans_multiple = min(ans_multiple, p)
break
else:
if p == 2:
if c == 1:
ans_multiple = min(ans_multiple, 2**2)
elif c == 2:
ans_multiple = min(ans_multiple, 2**4)
elif p == 3:
if c == 1:
ans_multiple = min(ans_multiple, 3**2)
#print('p', p, 'c', c)
ans = X*ans_multiple
print(ans)
FromBooska