結果

問題 No.1330 Multiply or Divide
ユーザー rin204
提出日時 2022-02-24 22:14:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 103,680 KB
最終ジャッジ日時 2024-07-02 14:06:16
合計ジャッジ時間 5,849 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 39 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, p = map(int, input().split())
A = list(map(int, input().split()))
ma_ = max(A)
if ma_ > m:
    print(1)
    exit()
for i in range(n):
    while A[i] % p == 0:
        A[i] //= p

ma = max(A)
if ma == 1:
    print(-1)
else:
    cnt = 0
    x = 1
    while x * ma_ <= m:
        x *= ma
        cnt += 1
    print(cnt + 1)
0