結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー FromBooskaFromBooska
提出日時 2023-08-13 19:37:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,532 ms / 2,000 ms
コード長 1,578 bytes
コンパイル時間 475 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 78,664 KB
最終ジャッジ日時 2023-08-13 19:37:24
合計ジャッジ時間 18,754 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,532 ms
78,664 KB
testcase_01 AC 663 ms
77,644 KB
testcase_02 AC 645 ms
77,868 KB
testcase_03 AC 664 ms
77,564 KB
testcase_04 AC 637 ms
77,696 KB
testcase_05 AC 648 ms
77,620 KB
testcase_06 AC 638 ms
77,904 KB
testcase_07 AC 661 ms
77,680 KB
testcase_08 AC 648 ms
77,724 KB
testcase_09 AC 659 ms
77,636 KB
testcase_10 AC 447 ms
77,728 KB
testcase_11 AC 477 ms
77,796 KB
testcase_12 AC 465 ms
77,860 KB
testcase_13 AC 475 ms
77,840 KB
testcase_14 AC 455 ms
77,608 KB
testcase_15 AC 452 ms
77,768 KB
testcase_16 AC 471 ms
77,520 KB
testcase_17 AC 456 ms
77,532 KB
testcase_18 AC 464 ms
77,672 KB
testcase_19 AC 107 ms
77,420 KB
testcase_20 AC 107 ms
77,648 KB
testcase_21 AC 108 ms
77,872 KB
testcase_22 AC 112 ms
78,044 KB
testcase_23 AC 108 ms
77,636 KB
testcase_24 AC 109 ms
77,856 KB
testcase_25 AC 108 ms
77,460 KB
testcase_26 AC 107 ms
77,592 KB
testcase_27 AC 107 ms
77,568 KB
testcase_28 AC 72 ms
71,252 KB
testcase_29 AC 73 ms
71,208 KB
testcase_30 AC 70 ms
71,064 KB
testcase_31 AC 70 ms
71,060 KB
testcase_32 AC 70 ms
71,264 KB
testcase_33 AC 70 ms
71,420 KB
testcase_34 AC 72 ms
71,344 KB
testcase_35 AC 71 ms
71,120 KB
testcase_36 AC 70 ms
71,400 KB
testcase_37 AC 70 ms
71,160 KB
testcase_38 AC 73 ms
71,216 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