結果
| 問題 |
No.1330 Multiply or Divide
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-08 21:59:23 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 492 bytes |
| コンパイル時間 | 445 ms |
| コンパイル使用メモリ | 82,256 KB |
| 実行使用メモリ | 104,320 KB |
| 最終ジャッジ日時 | 2024-11-16 18:21:00 |
| 合計ジャッジ時間 | 4,700 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 45 WA * 1 |
ソースコード
n,m,p = map(int,input().split())
a = list(map(int,input().split()))
ans = float("INF")
ma = max(a)
if ma > m:
print(1)
exit()
for i in a:
now = i
count = 0
while now%p == 0:
now //= p
count += 1
if now == 1:
continue
x = 1
c = 0
count += 1
while x*ma <= m:
x *= now
c += count
if x > m:
ans = min(ans,c)
else:
ans = min(ans,c+1)
if ans == float("INF"):
print(-1)
else:
print(ans)