結果
問題 | No.1330 Multiply or Divide |
ユーザー |
![]() |
提出日時 | 2021-01-08 22:15:38 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 574 bytes |
コンパイル時間 | 186 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 105,344 KB |
最終ジャッジ日時 | 2024-11-16 18:24:39 |
合計ジャッジ時間 | 6,024 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 45 WA * 1 |
ソースコード
import sys input = sys.stdin.readline N, M, P = map(int, input().split()) a = list(map(int, input().split())) a.sort() x = 1 res = 1000 for i in range(N): y = a[i] c = 0 while y % P == 0: y //= P c += 1 if y == 1: continue t = 1 for j in range(31): if t * a[-1] > M: res = min(res, (c + 1) * j + 1) break t *= y for i in range(100): if x > M: print(min(res, i)) break for j in range(N - 1, -1, -1): if (x * a[j]) % P or (x * a[j]) > M: x *= a[j] break else: if res != 1000: print(res) else: print(-1)