結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー AEnAEn
提出日時 2022-11-22 01:00:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 750 ms / 2,000 ms
コード長 1,124 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 81,740 KB
実行使用メモリ 78,416 KB
最終ジャッジ日時 2023-10-23 20:00:54
合計ジャッジ時間 15,019 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 750 ms
76,668 KB
testcase_01 AC 508 ms
77,044 KB
testcase_02 AC 511 ms
77,540 KB
testcase_03 AC 495 ms
77,368 KB
testcase_04 AC 508 ms
77,252 KB
testcase_05 AC 497 ms
77,324 KB
testcase_06 AC 511 ms
77,468 KB
testcase_07 AC 513 ms
77,512 KB
testcase_08 AC 506 ms
77,320 KB
testcase_09 AC 499 ms
77,272 KB
testcase_10 AC 500 ms
77,460 KB
testcase_11 AC 434 ms
77,724 KB
testcase_12 AC 426 ms
77,196 KB
testcase_13 AC 429 ms
77,504 KB
testcase_14 AC 478 ms
78,416 KB
testcase_15 AC 429 ms
77,196 KB
testcase_16 AC 441 ms
77,724 KB
testcase_17 AC 438 ms
77,460 KB
testcase_18 AC 455 ms
78,180 KB
testcase_19 AC 99 ms
76,836 KB
testcase_20 AC 103 ms
77,000 KB
testcase_21 AC 104 ms
77,024 KB
testcase_22 AC 107 ms
76,656 KB
testcase_23 AC 114 ms
76,976 KB
testcase_24 AC 107 ms
77,056 KB
testcase_25 AC 109 ms
76,760 KB
testcase_26 AC 100 ms
76,932 KB
testcase_27 AC 108 ms
76,748 KB
testcase_28 AC 40 ms
55,604 KB
testcase_29 AC 40 ms
55,604 KB
testcase_30 AC 40 ms
55,604 KB
testcase_31 AC 40 ms
55,604 KB
testcase_32 AC 41 ms
55,604 KB
testcase_33 AC 41 ms
55,604 KB
testcase_34 AC 40 ms
55,604 KB
testcase_35 AC 40 ms
55,604 KB
testcase_36 AC 40 ms
55,604 KB
testcase_37 AC 42 ms
55,604 KB
testcase_38 AC 41 ms
55,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import math
def sieve_of_eratosthenes(n):
    prime = [True]*(n+1)
    prime[0] = False
    prime[1] = False
    sqrt_n = math.ceil(math.sqrt(n))
    for i in range(2, sqrt_n+1):
        if prime[i]:
            for j in range(2*i, n+1, i):
                prime[j] = False
    return prime

p = sieve_of_eratosthenes(31)
num = []
for i in range(len(p)):
    if p[i]:
        num.append(i)

Y = defaultdict(dict)
for i in range(2,32):
    y = i
    for j in num:
        while y%j==0:
            if j in Y[i]:
                Y[i][j] += 1
            else:
                Y[i][j] = 1
            y //= j

T = int(input())
for i in range(T):
    N = int(input())
    X = N
    s = defaultdict(int)
    for j in range(len(num)):
        while X%num[j]==0:
            s[num[j]] += 1
            X //= num[j]
    cnt = 1
    for key in s.keys():
        cnt *= s[key]+1
    for key in Y.keys():
        cnt2 = cnt
        for key2 in Y[key].keys():
            cnt2 //= s[key2]+1
            cnt2 *= s[key2]+Y[key][key2]+1
        if cnt2==cnt*2:
            print(N*key)
            break
0