結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 160 ms
29,472 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 33 ms
10,752 KB
testcase_04 AC 32 ms
10,752 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 104 ms
14,704 KB
testcase_07 WA -
testcase_08 AC 171 ms
33,060 KB
testcase_09 AC 184 ms
32,936 KB
testcase_10 AC 169 ms
32,932 KB
testcase_11 AC 167 ms
32,576 KB
testcase_12 AC 171 ms
33,060 KB
testcase_13 AC 32 ms
10,752 KB
testcase_14 AC 31 ms
10,880 KB
testcase_15 AC 31 ms
10,752 KB
testcase_16 AC 30 ms
10,752 KB
testcase_17 AC 31 ms
10,752 KB
testcase_18 AC 99 ms
32,572 KB
testcase_19 AC 99 ms
32,936 KB
testcase_20 AC 97 ms
33,060 KB
testcase_21 AC 98 ms
32,576 KB
testcase_22 AC 101 ms
32,576 KB
testcase_23 AC 162 ms
32,608 KB
testcase_24 AC 32 ms
10,752 KB
testcase_25 AC 31 ms
10,880 KB
testcase_26 AC 32 ms
10,752 KB
testcase_27 AC 32 ms
10,752 KB
testcase_28 AC 32 ms
10,880 KB
testcase_29 AC 32 ms
10,880 KB
testcase_30 AC 31 ms
10,880 KB
testcase_31 AC 33 ms
10,752 KB
testcase_32 AC 32 ms
10,752 KB
testcase_33 AC 33 ms
10,752 KB
testcase_34 AC 84 ms
27,180 KB
testcase_35 AC 47 ms
15,092 KB
testcase_36 AC 78 ms
25,312 KB
testcase_37 AC 72 ms
23,776 KB
testcase_38 AC 58 ms
18,800 KB
testcase_39 AC 49 ms
16,436 KB
testcase_40 AC 53 ms
17,284 KB
testcase_41 AC 42 ms
14,020 KB
testcase_42 AC 69 ms
22,700 KB
testcase_43 AC 74 ms
24,648 KB
testcase_44 AC 144 ms
14,704 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