結果

問題 No.1330 Multiply or Divide
ユーザー moharan627moharan627
提出日時 2021-01-08 22:20:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,263 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 33,188 KB
最終ジャッジ日時 2024-04-28 03:37:48
合計ジャッジ時間 5,002 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 135 ms
29,596 KB
testcase_02 WA -
testcase_03 AC 25 ms
10,880 KB
testcase_04 AC 24 ms
10,752 KB
testcase_05 AC 24 ms
10,880 KB
testcase_06 AC 85 ms
14,696 KB
testcase_07 WA -
testcase_08 AC 140 ms
33,052 KB
testcase_09 AC 153 ms
33,052 KB
testcase_10 AC 144 ms
33,052 KB
testcase_11 AC 136 ms
32,692 KB
testcase_12 AC 140 ms
32,920 KB
testcase_13 AC 25 ms
10,880 KB
testcase_14 AC 24 ms
10,752 KB
testcase_15 AC 25 ms
11,008 KB
testcase_16 AC 24 ms
10,752 KB
testcase_17 AC 24 ms
10,880 KB
testcase_18 AC 134 ms
32,568 KB
testcase_19 AC 133 ms
32,920 KB
testcase_20 AC 132 ms
32,924 KB
testcase_21 AC 134 ms
32,568 KB
testcase_22 AC 136 ms
32,696 KB
testcase_23 AC 130 ms
33,188 KB
testcase_24 AC 25 ms
10,752 KB
testcase_25 AC 24 ms
10,880 KB
testcase_26 AC 24 ms
10,752 KB
testcase_27 AC 24 ms
10,752 KB
testcase_28 AC 24 ms
10,752 KB
testcase_29 AC 24 ms
10,880 KB
testcase_30 AC 23 ms
10,752 KB
testcase_31 AC 23 ms
10,752 KB
testcase_32 AC 23 ms
10,880 KB
testcase_33 AC 25 ms
10,752 KB
testcase_34 AC 109 ms
27,052 KB
testcase_35 AC 46 ms
15,084 KB
testcase_36 AC 94 ms
25,304 KB
testcase_37 AC 88 ms
23,768 KB
testcase_38 AC 64 ms
18,788 KB
testcase_39 AC 50 ms
16,232 KB
testcase_40 AC 59 ms
17,304 KB
testcase_41 AC 41 ms
14,272 KB
testcase_42 AC 86 ms
22,560 KB
testcase_43 AC 94 ms
24,764 KB
testcase_44 AC 117 ms
14,828 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]
        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