結果

問題 No.1330 Multiply or Divide
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-01-08 21:59:23
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 492 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 104,576 KB
最終ジャッジ日時 2024-04-28 05:43:32
合計ジャッジ時間 5,488 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 88 ms
104,576 KB
testcase_02 AC 39 ms
51,840 KB
testcase_03 AC 38 ms
51,968 KB
testcase_04 AC 40 ms
51,584 KB
testcase_05 AC 41 ms
52,224 KB
testcase_06 AC 77 ms
97,024 KB
testcase_07 AC 104 ms
104,320 KB
testcase_08 AC 120 ms
102,016 KB
testcase_09 AC 121 ms
101,904 KB
testcase_10 AC 122 ms
102,016 KB
testcase_11 AC 116 ms
101,888 KB
testcase_12 AC 113 ms
101,760 KB
testcase_13 AC 40 ms
52,480 KB
testcase_14 AC 42 ms
51,840 KB
testcase_15 AC 39 ms
51,968 KB
testcase_16 AC 40 ms
52,352 KB
testcase_17 AC 39 ms
51,840 KB
testcase_18 AC 99 ms
101,888 KB
testcase_19 AC 101 ms
101,760 KB
testcase_20 AC 96 ms
101,760 KB
testcase_21 AC 94 ms
102,016 KB
testcase_22 AC 99 ms
101,888 KB
testcase_23 AC 106 ms
102,016 KB
testcase_24 AC 39 ms
51,584 KB
testcase_25 AC 39 ms
52,224 KB
testcase_26 AC 38 ms
52,096 KB
testcase_27 AC 37 ms
51,968 KB
testcase_28 AC 42 ms
52,340 KB
testcase_29 AC 39 ms
51,968 KB
testcase_30 AC 39 ms
51,968 KB
testcase_31 AC 40 ms
51,584 KB
testcase_32 AC 39 ms
51,584 KB
testcase_33 AC 39 ms
51,968 KB
testcase_34 AC 78 ms
96,128 KB
testcase_35 AC 51 ms
68,224 KB
testcase_36 AC 79 ms
91,264 KB
testcase_37 AC 70 ms
87,552 KB
testcase_38 AC 61 ms
76,672 KB
testcase_39 AC 56 ms
70,400 KB
testcase_40 AC 55 ms
73,344 KB
testcase_41 AC 48 ms
65,152 KB
testcase_42 AC 66 ms
84,992 KB
testcase_43 AC 67 ms
88,704 KB
testcase_44 AC 91 ms
97,536 KB
testcase_45 AC 98 ms
97,968 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