結果

問題 No.1330 Multiply or Divide
ユーザー H20
提出日時 2021-01-08 22:17:33
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 437 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 162,048 KB
最終ジャッジ日時 2024-11-16 12:48:21
合計ジャッジ時間 16,811 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 37 WA * 6 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,P = map(int, input().split())
A = list(map(int, input().split()))
divA = [0]*N
cntDiv = [0]*N
maxA = max(A)
if maxA>M:
    print(1)
    exit()
aaa=0
for i in range(N):
    cnt = 0
    temp = A[i]
    while temp % P ==0:
        temp=temp//P
        cnt+=1
    divA[i]=temp
    cntDiv[i]=cnt
    aaa=max(aaa,temp/(cnt+1))

if divA.count(1)==N:
    print(-1)
    exit()

cnt = 1
x = 1
while maxA*x<M:
    cnt+=1
    x*=aaa

print(cnt)
0