結果
問題 | No.1538 引きこもりさんは引き算が得意。 |
ユーザー |
![]() |
提出日時 | 2025-06-12 15:41:51 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 593 bytes |
コンパイル時間 | 158 ms |
コンパイル使用メモリ | 82,404 KB |
実行使用メモリ | 57,344 KB |
最終ジャッジ日時 | 2025-06-12 15:42:02 |
合計ジャッジ時間 | 4,432 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 WA * 14 |
ソースコード
import math from functools import reduce def compute_gcd(arr): def gcd(a, b): while b: a, b = b, a % b return a non_zero = [x for x in arr if x != 0] if not non_zero: return 0 current_gcd = abs(non_zero[0]) for num in non_zero[1:]: current_gcd = gcd(current_gcd, abs(num)) if current_gcd == 1: break return current_gcd n, k = map(int, input().split()) a = list(map(int, input().split())) g = compute_gcd(a) if g == 0: print("Yes" if k == 0 else "No") else: print("Yes" if k % g == 0 else "No")