結果

問題 No.1330 Multiply or Divide
ユーザー moharan627moharan627
提出日時 2021-01-08 22:20:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,173 bytes
コンパイル時間 558 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 105,216 KB
最終ジャッジ日時 2024-04-28 03:37:36
合計ジャッジ時間 4,937 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 85 ms
102,784 KB
testcase_02 WA -
testcase_03 AC 33 ms
52,864 KB
testcase_04 AC 32 ms
52,224 KB
testcase_05 AC 32 ms
52,480 KB
testcase_06 AC 81 ms
96,640 KB
testcase_07 WA -
testcase_08 AC 117 ms
100,224 KB
testcase_09 AC 113 ms
99,968 KB
testcase_10 AC 109 ms
99,840 KB
testcase_11 AC 116 ms
99,840 KB
testcase_12 AC 116 ms
100,096 KB
testcase_13 AC 34 ms
52,096 KB
testcase_14 AC 32 ms
52,352 KB
testcase_15 AC 33 ms
52,096 KB
testcase_16 AC 34 ms
52,480 KB
testcase_17 AC 34 ms
52,480 KB
testcase_18 AC 98 ms
100,052 KB
testcase_19 AC 102 ms
100,096 KB
testcase_20 AC 99 ms
99,968 KB
testcase_21 AC 96 ms
100,096 KB
testcase_22 AC 98 ms
99,968 KB
testcase_23 AC 99 ms
99,272 KB
testcase_24 AC 34 ms
52,352 KB
testcase_25 AC 34 ms
52,480 KB
testcase_26 AC 33 ms
52,608 KB
testcase_27 AC 37 ms
52,352 KB
testcase_28 AC 33 ms
52,352 KB
testcase_29 AC 34 ms
52,736 KB
testcase_30 AC 35 ms
52,480 KB
testcase_31 AC 37 ms
52,352 KB
testcase_32 AC 32 ms
52,608 KB
testcase_33 AC 33 ms
52,352 KB
testcase_34 AC 83 ms
96,000 KB
testcase_35 AC 51 ms
69,376 KB
testcase_36 AC 75 ms
91,520 KB
testcase_37 AC 71 ms
88,192 KB
testcase_38 AC 59 ms
77,568 KB
testcase_39 AC 53 ms
71,040 KB
testcase_40 AC 60 ms
74,240 KB
testcase_41 AC 54 ms
66,560 KB
testcase_42 AC 73 ms
85,760 KB
testcase_43 AC 76 ms
88,960 KB
testcase_44 AC 83 ms
97,152 KB
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 入力を整数に変換して受け取る
import sys
# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力の文字列を1文字ずつに分けたものの配列を受け取る
def LC(): return list(input())
# 入力の数字列を1桁ずつに分けたものの配列を受け取る
def IC():return [int(c) for c in input()]
#少ない1行のint変数に入れる様の入力.例:N, A, B = map(int, input().split())
def MI(): return map(int, input().split())
def solve():
    N,M,P = MI()
    A = LI()
    MinOpe = -1
    import math
    from math import ceil, floor
    for i in range(N):
        A_tmp = A[i]
        Multmp = 0
        while(A_tmp%P == 0):
            A_tmp = A_tmp//P
            Multmp +=1
        if(A_tmp<=1):
            continue
        Ope = floor(math.log(M, A_tmp))
        if(MinOpe == -1):
            MinOpe = Ope*(Multmp+1)+1
        else:
            if(MinOpe > Ope*(Multmp+1)+1):
                MinOpe = Ope*(Multmp+1)+1
    print(MinOpe)
    return
solve()
0