結果

問題 No.1330 Multiply or Divide
ユーザー H3PO4H3PO4
提出日時 2021-01-08 21:30:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 27,264 KB
最終ジャッジ日時 2024-04-28 02:06:37
合計ジャッジ時間 7,247 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 218 ms
23,132 KB
testcase_02 WA -
testcase_03 AC 24 ms
10,624 KB
testcase_04 AC 24 ms
10,752 KB
testcase_05 AC 24 ms
10,624 KB
testcase_06 AC 108 ms
13,336 KB
testcase_07 WA -
testcase_08 AC 230 ms
26,928 KB
testcase_09 AC 233 ms
26,920 KB
testcase_10 AC 223 ms
27,048 KB
testcase_11 AC 226 ms
27,136 KB
testcase_12 AC 226 ms
26,920 KB
testcase_13 AC 24 ms
10,624 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 23 ms
10,496 KB
testcase_17 WA -
testcase_18 AC 206 ms
27,264 KB
testcase_19 AC 212 ms
26,796 KB
testcase_20 AC 200 ms
26,924 KB
testcase_21 AC 221 ms
27,264 KB
testcase_22 AC 202 ms
27,136 KB
testcase_23 AC 218 ms
26,880 KB
testcase_24 AC 25 ms
10,752 KB
testcase_25 AC 23 ms
10,496 KB
testcase_26 AC 26 ms
10,496 KB
testcase_27 AC 25 ms
10,624 KB
testcase_28 AC 24 ms
10,624 KB
testcase_29 AC 23 ms
10,752 KB
testcase_30 AC 23 ms
10,624 KB
testcase_31 AC 24 ms
10,752 KB
testcase_32 AC 23 ms
10,624 KB
testcase_33 AC 24 ms
10,624 KB
testcase_34 AC 163 ms
23,152 KB
testcase_35 AC 61 ms
13,860 KB
testcase_36 AC 148 ms
21,132 KB
testcase_37 AC 137 ms
20,716 KB
testcase_38 AC 87 ms
16,352 KB
testcase_39 AC 71 ms
14,552 KB
testcase_40 AC 82 ms
15,332 KB
testcase_41 AC 54 ms
12,864 KB
testcase_42 AC 123 ms
19,852 KB
testcase_43 AC 140 ms
21,916 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, P = map(int, input().split())
A = map(int, input().split())


def solve(a):
    x = 1
    ct = 0
    div = 1
    while not a % P:
        div += 1
        a //= P

    if a == 1:
        return -1
    while x <= M:
        x *= a
        ct += div
    return ct


ans = float('inf')
for a in A:
    s = solve(a)
    if s != -1:
        ans = min(ans, s)
print(ans if ans != float('inf') else -1)
0