結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー brthyyjp
提出日時 2022-03-01 18:06:24
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,065 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 89,412 KB
最終ジャッジ日時 2024-07-08 00:43:41
合計ジャッジ時間 8,429 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other TLE * 1 -- * 36
権限があれば一括ダウンロードができます

ソースコード

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
    for i in range(2, 32):
        cnt1 = [0]*len(P)
        cnt2 = [0]*len(P)
        y = x
        z = i*x
        for j, p in enumerate(P):
            while y%p == 0:
                cnt1[j] += 1
                y //= p
            while z%p == 0:
                cnt2[j] += 1
                z //= p
        c1 = 1
        for c in cnt1:
            c1 *= (c+1)
        c2 = 1
        for c in cnt2:
            c2 *= (c+1)
        if c2%c1 == 0 and c2//c1 == 2:
            ans = i*x
            break
    print(ans)
0