結果

問題 No.1330 Multiply or Divide
ユーザー rin204
提出日時 2022-03-23 21:38:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 318 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 105,224 KB
最終ジャッジ日時 2024-10-12 00:30:02
合計ジャッジ時間 5,593 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 37 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, p = map(int, input().split())
A = list(map(int, input().split()))
ma = max(A)
m = (m + ma - 1) // ma
if m == 1:
    print(1)
    exit()
ma = 0
for a in A:
    while a % p == 0:
        a //= p
    ma = max(a, 0)

if ma == 1:
    print(-1)
    exit()
i = 1
ans = 1
while i < m:
    i *= ma
    ans += 1
print(ans)
0