結果

問題 No.1250 汝は倍数なりや?
ユーザー sangonanasangonana
提出日時 2021-04-08 11:09:35
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 221 ms / 1,000 ms
コード長 391 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 31,300 KB
最終ジャッジ日時 2024-06-23 15:12:57
合計ジャッジ時間 4,754 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n,h=map(int,input().split())
a=list(map(int,input().split()))

def prime_list(x):
	i=2
	prime=defaultdict(int)
	while i*i<=x:
		while x%i==0:
			x//=i
			prime[i]+=1
		i+=1
	if x>1:
		prime[x]+=1
	return prime

p=prime_list(h)

for x in a:
	for y in p.keys():
		while p[y]>0 and x%y==0:
			p[y]-=1

if sum(p.values())==0:
	print("YES")
else:
	print("NO")
0