結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー brthyyjpbrthyyjp
提出日時 2022-03-01 18:11:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,091 ms / 2,000 ms
コード長 1,083 bytes
コンパイル時間 1,290 ms
コンパイル使用メモリ 86,624 KB
実行使用メモリ 80,520 KB
最終ジャッジ日時 2023-09-22 08:30:27
合計ジャッジ時間 13,089 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,091 ms
80,100 KB
testcase_01 AC 389 ms
80,216 KB
testcase_02 AC 393 ms
80,100 KB
testcase_03 AC 395 ms
80,516 KB
testcase_04 AC 402 ms
80,432 KB
testcase_05 AC 392 ms
80,520 KB
testcase_06 AC 404 ms
80,308 KB
testcase_07 AC 411 ms
80,324 KB
testcase_08 AC 391 ms
80,392 KB
testcase_09 AC 400 ms
80,320 KB
testcase_10 AC 226 ms
79,272 KB
testcase_11 AC 233 ms
80,184 KB
testcase_12 AC 240 ms
80,000 KB
testcase_13 AC 231 ms
79,740 KB
testcase_14 AC 233 ms
79,876 KB
testcase_15 AC 234 ms
79,884 KB
testcase_16 AC 235 ms
80,356 KB
testcase_17 AC 236 ms
80,168 KB
testcase_18 AC 243 ms
80,492 KB
testcase_19 AC 93 ms
77,276 KB
testcase_20 AC 99 ms
77,044 KB
testcase_21 AC 99 ms
77,904 KB
testcase_22 AC 97 ms
76,960 KB
testcase_23 AC 101 ms
77,216 KB
testcase_24 AC 94 ms
77,024 KB
testcase_25 AC 96 ms
76,956 KB
testcase_26 AC 97 ms
77,272 KB
testcase_27 AC 96 ms
77,352 KB
testcase_28 AC 68 ms
71,712 KB
testcase_29 AC 68 ms
71,412 KB
testcase_30 AC 69 ms
71,508 KB
testcase_31 AC 67 ms
71,384 KB
testcase_32 AC 68 ms
71,492 KB
testcase_33 AC 69 ms
71,412 KB
testcase_34 AC 69 ms
71,188 KB
testcase_35 AC 68 ms
71,360 KB
testcase_36 AC 68 ms
71,648 KB
testcase_37 AC 68 ms
71,184 KB
testcase_38 AC 67 ms
71,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

import math

def sieve(n):
    ass = []
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, int(math.sqrt(n))+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    for i in range(n+1):
        if is_prime[i]:
            ass.append(i)
    return(ass)

P = sieve(35)

t = int(input())
for _ in range(t):
    x = int(input())
    ans = -1
    cnt1 = [0]*len(P)
    y = x
    for j, p in enumerate(P):
        while y%p == 0:
            cnt1[j] += 1
            y //= p
    c1 = 1
    for c in cnt1:
        c1 *= (c+1)
    for i in range(2, 32):
        cnt2 = [0]*len(P)
        z = i
        for j, p in enumerate(P):
            while z%p == 0:
                cnt2[j] += 1
                z //= p
        c2 = 1
        for j, c in enumerate(cnt2):
            c2 *= (cnt1[j]+c+1)
        if c2%c1 == 0 and c2//c1 == 2:
            ans = i*x
            break
    print(ans)
0