結果

問題 No.1330 Multiply or Divide
ユーザー moharan627moharan627
提出日時 2021-01-08 22:25:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,326 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 33,188 KB
最終ジャッジ日時 2024-04-28 03:46:26
合計ジャッジ時間 4,761 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 149 ms
29,600 KB
testcase_02 AC 26 ms
10,880 KB
testcase_03 AC 27 ms
10,880 KB
testcase_04 AC 26 ms
10,880 KB
testcase_05 AC 28 ms
10,880 KB
testcase_06 AC 98 ms
14,836 KB
testcase_07 WA -
testcase_08 AC 158 ms
33,064 KB
testcase_09 AC 165 ms
33,064 KB
testcase_10 AC 156 ms
33,188 KB
testcase_11 AC 150 ms
32,704 KB
testcase_12 AC 153 ms
33,068 KB
testcase_13 AC 26 ms
10,880 KB
testcase_14 AC 26 ms
10,880 KB
testcase_15 AC 26 ms
10,880 KB
testcase_16 AC 27 ms
10,880 KB
testcase_17 AC 27 ms
11,008 KB
testcase_18 AC 92 ms
32,700 KB
testcase_19 AC 89 ms
33,060 KB
testcase_20 AC 91 ms
33,060 KB
testcase_21 AC 90 ms
32,704 KB
testcase_22 AC 87 ms
32,828 KB
testcase_23 WA -
testcase_24 AC 26 ms
10,880 KB
testcase_25 AC 26 ms
10,880 KB
testcase_26 WA -
testcase_27 AC 27 ms
10,880 KB
testcase_28 AC 26 ms
11,008 KB
testcase_29 AC 27 ms
10,880 KB
testcase_30 AC 26 ms
10,880 KB
testcase_31 AC 27 ms
10,880 KB
testcase_32 AC 26 ms
10,880 KB
testcase_33 AC 28 ms
10,880 KB
testcase_34 AC 74 ms
27,184 KB
testcase_35 AC 41 ms
15,220 KB
testcase_36 AC 68 ms
25,448 KB
testcase_37 AC 63 ms
24,032 KB
testcase_38 AC 51 ms
18,796 KB
testcase_39 AC 42 ms
16,372 KB
testcase_40 AC 44 ms
17,540 KB
testcase_41 AC 35 ms
14,148 KB
testcase_42 AC 60 ms
22,700 KB
testcase_43 AC 67 ms
24,780 KB
testcase_44 AC 135 ms
14,832 KB
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 入力を整数に変換して受け取る
import sys
sys.setrecursionlimit(10 ** 6)#pypy3はnumpyを使えない,この行を消すこと.
# 入力を整数に変換して受け取る
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]
        if(A[i] >= M):
            print(1)
            exit()
        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