結果
| 問題 |
No.1250 汝は倍数なりや?
|
| コンテスト | |
| ユーザー |
hir355
|
| 提出日時 | 2020-10-09 21:28:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 118 ms / 1,000 ms |
| コード長 | 558 bytes |
| コンパイル時間 | 165 ms |
| コンパイル使用メモリ | 81,668 KB |
| 実行使用メモリ | 101,464 KB |
| 最終ジャッジ日時 | 2024-07-20 08:43:59 |
| 合計ジャッジ時間 | 4,722 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 49 |
ソースコード
from collections import Counter
def factorize(n):
a = 2
fct = []
while a * a <= n:
while n % a == 0:
n //= a
fct.append(a)
a += 1
if n > 1:
fct.append(n)
return fct
n, h = map(int, input().split())
p = Counter(factorize(h))
a = list(map(int, input().split()))
keys = list(p.keys())
for x in a:
for k in keys:
while p[k] > 0 and x % k == 0:
p[k] -= 1
x //= k
for v in p.values():
if v > 0:
print('NO')
break
else:
print('YES')
hir355