結果
問題 | No.1250 汝は倍数なりや? |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:15:38 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 96 ms / 1,000 ms |
コード長 | 907 bytes |
コンパイル時間 | 162 ms |
コンパイル使用メモリ | 82,600 KB |
実行使用メモリ | 107,948 KB |
最終ジャッジ日時 | 2025-03-20 21:16:31 |
合計ジャッジ時間 | 4,699 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 49 |
ソースコード
def get_prime_factors(h):factors = {}while h % 2 == 0:factors[2] = factors.get(2, 0) + 1h = h // 2i = 3while i * i <= h:while h % i == 0:factors[i] = factors.get(i, 0) + 1h = h // ii += 2if h > 1:factors[h] = 1return factorsn, h = map(int, input().split())a_list = list(map(int, input().split()))if h == 1:print("YES")exit()if any(x == 0 for x in a_list):print("YES")exit()factors = get_prime_factors(h)flag = Truefor p, required in factors.items():total = 0for a in a_list:current = abs(a)cnt = 0while current % p == 0:cnt += 1current = current // ptotal += cntif total >= required:breakif total < required:flag = Falsebreakprint("YES" if flag else "NO")