結果
| 問題 | No.1330 Multiply or Divide |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-08 21:59:23 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 492 bytes |
| 記録 | |
| コンパイル時間 | 185 ms |
| コンパイル使用メモリ | 85,176 KB |
| 実行使用メモリ | 113,280 KB |
| 最終ジャッジ日時 | 2026-05-11 23:44:17 |
| 合計ジャッジ時間 | 4,910 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 46 WA * 5 |
ソースコード
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)