結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー FromBooskaFromBooska
提出日時 2023-08-13 19:37:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,455 ms / 2,000 ms
コード長 1,578 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 82,512 KB
実行使用メモリ 76,876 KB
最終ジャッジ日時 2024-05-01 11:26:48
合計ジャッジ時間 16,124 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,455 ms
76,604 KB
testcase_01 AC 607 ms
76,608 KB
testcase_02 AC 600 ms
76,724 KB
testcase_03 AC 609 ms
76,468 KB
testcase_04 AC 602 ms
76,320 KB
testcase_05 AC 608 ms
76,816 KB
testcase_06 AC 624 ms
76,664 KB
testcase_07 AC 615 ms
76,468 KB
testcase_08 AC 605 ms
76,740 KB
testcase_09 AC 614 ms
76,812 KB
testcase_10 AC 410 ms
76,620 KB
testcase_11 AC 435 ms
76,752 KB
testcase_12 AC 427 ms
76,652 KB
testcase_13 AC 429 ms
76,536 KB
testcase_14 AC 423 ms
76,500 KB
testcase_15 AC 430 ms
76,876 KB
testcase_16 AC 426 ms
76,812 KB
testcase_17 AC 419 ms
76,640 KB
testcase_18 AC 423 ms
76,736 KB
testcase_19 AC 73 ms
74,208 KB
testcase_20 AC 73 ms
74,796 KB
testcase_21 AC 72 ms
73,964 KB
testcase_22 AC 76 ms
74,112 KB
testcase_23 AC 72 ms
74,856 KB
testcase_24 AC 74 ms
74,828 KB
testcase_25 AC 72 ms
74,876 KB
testcase_26 AC 72 ms
73,468 KB
testcase_27 AC 71 ms
73,540 KB
testcase_28 AC 37 ms
53,372 KB
testcase_29 AC 36 ms
52,528 KB
testcase_30 AC 36 ms
53,416 KB
testcase_31 AC 37 ms
53,672 KB
testcase_32 AC 36 ms
52,252 KB
testcase_33 AC 37 ms
53,044 KB
testcase_34 AC 36 ms
52,556 KB
testcase_35 AC 36 ms
52,136 KB
testcase_36 AC 37 ms
53,040 KB
testcase_37 AC 36 ms
52,744 KB
testcase_38 AC 36 ms
52,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# Xを素因数分解
# 既存素因数のべき乗を倍にするか、ない素因数を加える
# 10**11ということは37までに存在しない素因数があるはず
# 2*3*5*7*11*13*17*19*23*29*31*37 = 7*10**12
# 必要なのは37までの素因数だけ
# WAだった、2の乗数と3の乗数が両方増えるというパターンがある
# 素因数で考えると、そのコンビネーションもあるから難しい
# 発想の転換、multiplierは37までのどれかの数字にあると考えればいい
# 37超の素因数は無視する
# TLEしたので、素因数のべき乗数のリストをコピーして使う

primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41]

def low_prime_div_count(num):
    count = [0]*13
    div_count = 1
    for i in range(13):
        p = primes[i]
        c = 0
        while num%p == 0:
            num //= p
            c += 1
        count[i] = c
        div_count *= (c+1)
    return div_count, count

T = int(input())
for t in range(T):
    X = int(input())
    base, count = low_prime_div_count(X)
    #print('base', base, 'count', count)
    for n in range(2, 38):
        temp_count = count.copy()
        div_temp = 1
        n_ = n
        for i in range(13):
            p = primes[i]
            c = 0
            while n_%p == 0:
                n_ //= p
                c += 1
            temp_count[i] += c
            div_temp *= (temp_count[i]+1)
        #print('n', n, 'temp_count', temp_count, 'div_temp', div_temp)
        if div_temp == base*2:
            print(X*n)
            break
0