結果

問題 No.1330 Multiply or Divide
ユーザー c-yanc-yan
提出日時 2021-01-08 22:45:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 482 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 31,348 KB
最終ジャッジ日時 2023-08-10 12:32:12
合計ジャッジ時間 9,700 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 304 ms
31,224 KB
testcase_02 AC 16 ms
8,128 KB
testcase_03 AC 15 ms
7,776 KB
testcase_04 AC 15 ms
7,776 KB
testcase_05 AC 16 ms
7,864 KB
testcase_06 AC 112 ms
11,700 KB
testcase_07 AC 1,024 ms
31,348 KB
testcase_08 AC 309 ms
29,936 KB
testcase_09 AC 337 ms
29,956 KB
testcase_10 AC 308 ms
29,864 KB
testcase_11 AC 293 ms
29,864 KB
testcase_12 AC 305 ms
29,864 KB
testcase_13 AC 16 ms
7,876 KB
testcase_14 AC 15 ms
7,788 KB
testcase_15 AC 15 ms
7,816 KB
testcase_16 AC 16 ms
7,816 KB
testcase_17 AC 16 ms
7,860 KB
testcase_18 AC 79 ms
29,992 KB
testcase_19 AC 79 ms
29,848 KB
testcase_20 AC 79 ms
29,900 KB
testcase_21 AC 79 ms
29,820 KB
testcase_22 AC 79 ms
29,948 KB
testcase_23 AC 287 ms
29,948 KB
testcase_24 AC 16 ms
8,140 KB
testcase_25 AC 15 ms
8,132 KB
testcase_26 AC 16 ms
7,872 KB
testcase_27 AC 16 ms
8,240 KB
testcase_28 AC 15 ms
8,184 KB
testcase_29 AC 16 ms
8,100 KB
testcase_30 AC 16 ms
8,212 KB
testcase_31 AC 16 ms
8,220 KB
testcase_32 AC 16 ms
8,264 KB
testcase_33 AC 17 ms
7,872 KB
testcase_34 AC 63 ms
24,448 KB
testcase_35 AC 29 ms
12,648 KB
testcase_36 AC 57 ms
22,440 KB
testcase_37 AC 53 ms
20,920 KB
testcase_38 AC 39 ms
15,996 KB
testcase_39 AC 32 ms
13,516 KB
testcase_40 AC 36 ms
14,728 KB
testcase_41 AC 26 ms
11,524 KB
testcase_42 AC 51 ms
20,036 KB
testcase_43 AC 57 ms
21,776 KB
testcase_44 AC 1,312 ms
11,828 KB
testcase_45 AC 1,828 ms
11,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(x):
    c = 0
    while x % P == 0:
        c += 1
        x //= P
    return (x, c)

N, M, P, *A = map(int, open(0).read().split())

max_A = max(A)

if max_A > M:
    print(1)
    exit()

result = 10 ** 20
for m, c in map(f, A):
    if m == 1:
        continue
    t = 0
    x = 1
    while True:
        t += 1
        if x * max_A > M:
            break
        t += c
        x *= m
    result = min(result, t)
if result == 10 ** 20:
    print(-1)
else:
    print(result)
0