結果

問題 No.1330 Multiply or Divide
ユーザー rin204
提出日時 2022-03-23 21:38:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 319 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,056 KB
実行使用メモリ 105,172 KB
最終ジャッジ日時 2024-10-12 00:30:10
合計ジャッジ時間 4,666 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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, ma)

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