結果

問題 No.1330 Multiply or Divide
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-01-08 21:59:23
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 492 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 86,592 KB
実行使用メモリ 107,704 KB
最終ジャッジ日時 2023-08-10 12:26:43
合計ジャッジ時間 6,901 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 122 ms
107,688 KB
testcase_02 AC 72 ms
71,144 KB
testcase_03 AC 73 ms
71,028 KB
testcase_04 AC 70 ms
71,156 KB
testcase_05 AC 72 ms
71,032 KB
testcase_06 AC 107 ms
104,640 KB
testcase_07 AC 132 ms
107,704 KB
testcase_08 AC 139 ms
100,228 KB
testcase_09 AC 140 ms
100,508 KB
testcase_10 AC 141 ms
100,296 KB
testcase_11 AC 138 ms
100,440 KB
testcase_12 AC 139 ms
100,348 KB
testcase_13 AC 71 ms
71,052 KB
testcase_14 AC 71 ms
71,428 KB
testcase_15 AC 71 ms
71,276 KB
testcase_16 AC 71 ms
71,192 KB
testcase_17 AC 72 ms
71,188 KB
testcase_18 AC 124 ms
100,396 KB
testcase_19 AC 122 ms
100,296 KB
testcase_20 AC 123 ms
100,384 KB
testcase_21 AC 124 ms
100,292 KB
testcase_22 AC 124 ms
100,336 KB
testcase_23 AC 129 ms
99,768 KB
testcase_24 AC 71 ms
71,252 KB
testcase_25 AC 70 ms
71,280 KB
testcase_26 AC 70 ms
71,380 KB
testcase_27 AC 69 ms
71,008 KB
testcase_28 AC 72 ms
71,284 KB
testcase_29 AC 73 ms
71,196 KB
testcase_30 AC 72 ms
71,196 KB
testcase_31 AC 71 ms
71,188 KB
testcase_32 AC 71 ms
71,260 KB
testcase_33 AC 71 ms
71,032 KB
testcase_34 AC 108 ms
100,580 KB
testcase_35 AC 82 ms
80,740 KB
testcase_36 AC 101 ms
97,516 KB
testcase_37 AC 99 ms
94,924 KB
testcase_38 AC 89 ms
86,820 KB
testcase_39 AC 84 ms
81,816 KB
testcase_40 AC 86 ms
83,944 KB
testcase_41 AC 81 ms
78,556 KB
testcase_42 AC 96 ms
92,604 KB
testcase_43 AC 100 ms
95,120 KB
testcase_44 AC 126 ms
104,436 KB
testcase_45 AC 131 ms
104,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,p = map(int,input().split())
a = list(map(int,input().split()))
ans = float("INF")
ma = max(a)
if ma > m:
    print(1)
    exit()

for i in a:
    now = i
    count = 0
    while now%p == 0:
        now //= p
        count += 1
    if now == 1:
        continue
    x = 1
    c = 0
    count += 1
    while x*ma <= m:
        x *= now
        c += count
    if x > m:
        ans = min(ans,c)
    else:
        ans = min(ans,c+1)
if ans == float("INF"):
    print(-1)
else:
    print(ans)
0