結果
問題 |
No.1330 Multiply or Divide
|
ユーザー |
|
提出日時 | 2021-01-08 21:30:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 402 bytes |
コンパイル時間 | 92 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 27,264 KB |
最終ジャッジ日時 | 2024-11-16 10:15:54 |
合計ジャッジ時間 | 8,342 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 WA * 8 |
ソースコード
N, M, P = map(int, input().split()) A = map(int, input().split()) def solve(a): x = 1 ct = 0 div = 1 while not a % P: div += 1 a //= P if a == 1: return -1 while x <= M: x *= a ct += div return ct ans = float('inf') for a in A: s = solve(a) if s != -1: ans = min(ans, s) print(ans if ans != float('inf') else -1)