結果

問題 No.1330 Multiply or Divide
ユーザー ntuda
提出日時 2025-08-26 21:04:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 352 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 82,644 KB
実行使用メモリ 105,176 KB
最終ジャッジ日時 2025-08-26 21:04:15
合計ジャッジ時間 6,420 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,P = map(int,input().split())
A = list(map(int,input().split()))
INF = 10 ** 9
ans = INF
for i in range(N):
    a = A[i]
    while a % P == 0:
        a //= P
    if a > 1:
        cnt = 0
        now = 1
        while M >= now:
            now *= a
            cnt += 1
        ans = min(ans,cnt)
if ans == INF:
    print(-1)
else:
    print(ans)

0