結果

問題 No.1250 汝は倍数なりや?
ユーザー ygd.ygd.
提出日時 2020-10-17 19:57:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 149 ms / 1,000 ms
コード長 811 bytes
コンパイル時間 1,483 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 102,516 KB
最終ジャッジ日時 2023-09-28 08:33:40
合計ジャッジ時間 7,504 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,672 KB
testcase_01 AC 73 ms
71,364 KB
testcase_02 AC 74 ms
71,784 KB
testcase_03 AC 76 ms
71,712 KB
testcase_04 AC 72 ms
71,832 KB
testcase_05 AC 74 ms
71,696 KB
testcase_06 AC 72 ms
71,372 KB
testcase_07 AC 72 ms
71,492 KB
testcase_08 AC 73 ms
71,476 KB
testcase_09 AC 74 ms
71,716 KB
testcase_10 AC 71 ms
71,672 KB
testcase_11 AC 73 ms
71,372 KB
testcase_12 AC 70 ms
71,372 KB
testcase_13 AC 74 ms
71,592 KB
testcase_14 AC 71 ms
71,720 KB
testcase_15 AC 71 ms
71,712 KB
testcase_16 AC 70 ms
71,480 KB
testcase_17 AC 72 ms
71,812 KB
testcase_18 AC 72 ms
71,584 KB
testcase_19 AC 72 ms
71,376 KB
testcase_20 AC 74 ms
71,816 KB
testcase_21 AC 73 ms
71,700 KB
testcase_22 AC 71 ms
71,520 KB
testcase_23 AC 74 ms
71,692 KB
testcase_24 AC 78 ms
76,736 KB
testcase_25 AC 78 ms
76,680 KB
testcase_26 AC 78 ms
76,788 KB
testcase_27 AC 80 ms
76,800 KB
testcase_28 AC 77 ms
76,104 KB
testcase_29 AC 75 ms
71,820 KB
testcase_30 AC 81 ms
76,332 KB
testcase_31 AC 74 ms
71,868 KB
testcase_32 AC 81 ms
76,876 KB
testcase_33 AC 149 ms
100,008 KB
testcase_34 AC 116 ms
91,868 KB
testcase_35 AC 132 ms
102,516 KB
testcase_36 AC 146 ms
99,456 KB
testcase_37 AC 110 ms
92,312 KB
testcase_38 AC 112 ms
94,348 KB
testcase_39 AC 120 ms
91,976 KB
testcase_40 AC 122 ms
92,400 KB
testcase_41 AC 110 ms
96,648 KB
testcase_42 AC 104 ms
86,820 KB
testcase_43 AC 138 ms
99,348 KB
testcase_44 AC 102 ms
86,504 KB
testcase_45 AC 137 ms
99,528 KB
testcase_46 AC 97 ms
83,100 KB
testcase_47 AC 123 ms
94,272 KB
testcase_48 AC 73 ms
71,176 KB
testcase_49 AC 75 ms
75,448 KB
testcase_50 AC 71 ms
71,380 KB
testcase_51 AC 75 ms
75,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1: #最後に残ったもの(もしくは素数)の場合はここ
        arr.append([temp, 1])
 
    if arr==[]: #1の場合はここ
        arr.append([n, 1])
 
    return arr

N,H = map(int,input().split()); MOD = pow(10,9)+7
A = list(map(int,input().split()))

B = factorization(H)
#print(B)
for i in range(N):
  a = A[i]
  for j in range(len(B)):
    while a%B[j][0] == 0 and B[j][1] > 0:
      a = a//B[j][0]
      B[j][1] -= 1
Flag = True
for x in B:
  if x[1] != 0:
    Flag = False
    break
if Flag:
  print("YES")
else:
  print("NO")
0