結果

問題 No.1330 Multiply or Divide
ユーザー hir355
提出日時 2021-01-08 21:36:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 358 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 103,680 KB
最終ジャッジ日時 2024-11-16 10:34:56
合計ジャッジ時間 5,146 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, p = map(int, input().split())
a = list(map(int, input().split()))
ans = 10 ** 9
s = set()
t = 1
for k in a:
    t = 1
    while k % p == 0:
        k //= p
        t += 1
    if k == 1:
        continue
    x = 1
    res = 0
    while x <= m:
        x *= k
        res += t
    ans = min(ans, res)
if ans != 10 ** 9:
    print(ans)
else:
    print(-1)
0