結果
問題 |
No.1330 Multiply or Divide
|
ユーザー |
![]() |
提出日時 | 2021-01-08 22:43:29 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 467 bytes |
コンパイル時間 | 394 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 32,660 KB |
最終ジャッジ日時 | 2024-11-16 14:07:34 |
合計ジャッジ時間 | 9,594 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 39 WA * 7 |
ソースコード
def f(x): c = 0 while x % P == 0: c += 1 x //= P return (x, c) N, M, P, *A = map(int, open(0).read().split()) max_A = max(A) if max_A > M: print(1) exit() result = 10 ** 20 for m, c in map(f, A): if m == 1: continue t = 0 x = 1 while True: t += 1 if x * max_A > M: break x *= m result = min(result, t) if result == 10 ** 20: print(-1) else: print(result)