結果

問題 No.1330 Multiply or Divide
ユーザー marroncastle
提出日時 2021-01-20 19:10:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 331 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 82,060 KB
実行使用メモリ 104,780 KB
最終ジャッジ日時 2024-12-23 09:46:29
合計ジャッジ時間 6,049 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, P = map(int, input().split())
A = list(map(int, input().split()))
maxa = max(A)
for i in range(N):
  while A[i]%P==0:
    A[i] //= P
maxa2 = max(A)
ans = 0
x = 1
if M==1:
  print(0)
else:
  while x<=M:
    ans += 1
    if x*maxa>M:
      break
    if ans>1 and maxa2==1:
      ans = -1
      break
    x *= maxa2
  print(ans)
0