結果

問題 No.1330 Multiply or Divide
ユーザー brthyyjpbrthyyjp
提出日時 2022-02-03 15:09:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 347 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 118,256 KB
最終ジャッジ日時 2024-06-11 09:56:30
合計ジャッジ時間 5,670 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, p = map(int, input().split())
A = list(map(int, input().split()))

if m == 1:
    print(0)
    exit()

if max(A) > m:
    print(1)
    exit()

B = []
for a in A:
    while a%p == 0:
        a //= p
    B.append(a)
B.sort(reverse=True)

if B[0] == 1:
    print(-1)
    exit()

x = 1
ans =0
while x <= m:
    ans += 1
    x *= B[0]
print(ans)
0