結果

問題 No.1330 Multiply or Divide
ユーザー tktk_snsntktk_snsn
提出日時 2021-09-25 13:03:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 483 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 31,392 KB
最終ジャッジ日時 2023-09-18 23:00:14
合計ジャッジ時間 9,862 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 210 ms
29,868 KB
testcase_02 WA -
testcase_03 AC 16 ms
7,780 KB
testcase_04 AC 16 ms
7,780 KB
testcase_05 AC 16 ms
7,820 KB
testcase_06 AC 136 ms
12,216 KB
testcase_07 WA -
testcase_08 AC 241 ms
30,488 KB
testcase_09 AC 265 ms
30,372 KB
testcase_10 AC 241 ms
30,360 KB
testcase_11 AC 228 ms
29,984 KB
testcase_12 AC 240 ms
30,412 KB
testcase_13 AC 15 ms
7,780 KB
testcase_14 AC 16 ms
7,816 KB
testcase_15 AC 15 ms
7,756 KB
testcase_16 AC 15 ms
7,904 KB
testcase_17 AC 15 ms
7,940 KB
testcase_18 AC 81 ms
30,000 KB
testcase_19 AC 77 ms
30,484 KB
testcase_20 AC 78 ms
30,356 KB
testcase_21 AC 80 ms
29,976 KB
testcase_22 AC 82 ms
29,904 KB
testcase_23 WA -
testcase_24 AC 15 ms
8,080 KB
testcase_25 AC 15 ms
8,076 KB
testcase_26 WA -
testcase_27 AC 16 ms
8,264 KB
testcase_28 AC 15 ms
8,236 KB
testcase_29 AC 15 ms
8,088 KB
testcase_30 AC 15 ms
8,076 KB
testcase_31 AC 15 ms
8,252 KB
testcase_32 AC 16 ms
8,088 KB
testcase_33 AC 16 ms
7,900 KB
testcase_34 AC 63 ms
24,572 KB
testcase_35 AC 28 ms
12,664 KB
testcase_36 AC 57 ms
22,692 KB
testcase_37 AC 52 ms
21,296 KB
testcase_38 AC 39 ms
16,036 KB
testcase_39 AC 33 ms
13,608 KB
testcase_40 AC 36 ms
14,920 KB
testcase_41 AC 26 ms
11,456 KB
testcase_42 AC 52 ms
20,052 KB
testcase_43 AC 55 ms
22,052 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, P = map(int, input().split())
A = list(map(int, input().split()))
if M == 1:
    print(0)
    exit()

last = max(A)   # これ、最後に必ずかける
target = (M + last - 1) // last

if target == 1:
    print(1)
    exit()

ans = 10 ** 18
for a in A:
    cnt = 1
    x = a
    while x % P == 0:
        cnt += 1
        x //= P
    if x == 1:
        continue

    tmp = cnt * ((target + x - 1) // x) + 1
    ans = min(ans, tmp)

if ans >= 10 ** 18:
    ans = -1
print(ans)
0