結果

問題 No.1330 Multiply or Divide
ユーザー Kite_kumaKite_kuma
提出日時 2021-01-08 21:42:59
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 576 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 131,840 KB
最終ジャッジ日時 2024-04-28 06:18:10
合計ジャッジ時間 6,059 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,480 KB
testcase_01 AC 122 ms
107,008 KB
testcase_02 WA -
testcase_03 AC 41 ms
52,608 KB
testcase_04 AC 41 ms
51,712 KB
testcase_05 AC 41 ms
52,480 KB
testcase_06 AC 108 ms
125,952 KB
testcase_07 AC 341 ms
107,008 KB
testcase_08 AC 143 ms
126,916 KB
testcase_09 AC 147 ms
126,660 KB
testcase_10 AC 144 ms
126,668 KB
testcase_11 AC 141 ms
127,164 KB
testcase_12 AC 142 ms
126,668 KB
testcase_13 AC 43 ms
52,608 KB
testcase_14 AC 42 ms
52,608 KB
testcase_15 AC 41 ms
52,352 KB
testcase_16 AC 42 ms
52,480 KB
testcase_17 AC 42 ms
52,608 KB
testcase_18 AC 128 ms
126,664 KB
testcase_19 AC 128 ms
126,536 KB
testcase_20 AC 129 ms
126,676 KB
testcase_21 AC 131 ms
126,416 KB
testcase_22 AC 130 ms
126,648 KB
testcase_23 AC 134 ms
126,840 KB
testcase_24 AC 43 ms
52,352 KB
testcase_25 AC 42 ms
52,608 KB
testcase_26 AC 42 ms
52,864 KB
testcase_27 AC 41 ms
52,480 KB
testcase_28 AC 41 ms
52,352 KB
testcase_29 AC 41 ms
52,608 KB
testcase_30 AC 40 ms
52,864 KB
testcase_31 AC 41 ms
52,736 KB
testcase_32 AC 42 ms
52,736 KB
testcase_33 AC 43 ms
52,480 KB
testcase_34 AC 104 ms
120,192 KB
testcase_35 AC 63 ms
76,288 KB
testcase_36 AC 99 ms
113,408 KB
testcase_37 AC 94 ms
107,904 KB
testcase_38 AC 77 ms
89,344 KB
testcase_39 AC 66 ms
78,592 KB
testcase_40 AC 71 ms
83,456 KB
testcase_41 AC 60 ms
71,680 KB
testcase_42 AC 89 ms
102,528 KB
testcase_43 AC 95 ms
108,672 KB
testcase_44 AC 179 ms
131,584 KB
testcase_45 AC 208 ms
131,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, p = map(int, input().split())
a = list(map(int, input().split()))
d = list()
cnt = list()
flag = True
for c in a:
    tmp = 0
    while c % p == 0:
        c //= p
        tmp += 1
    if c > 1:
        flag = False
    d.append(c)
    cnt.append(tmp)
if flag:
    print(-1)
    exit()

dp = [1] * (100000)


for i in range(100000):
    now = dp[i]
    if now > m:
        print(i)
        exit()
    for j in range(n):
        c = a[j]
        if now * c > m:
            print(i + 1)
            exit()
        dp[i + cnt[j] + 1] = max(dp[i + cnt[j] + 1], now * d[j])
0