結果
問題 | No.1538 引きこもりさんは引き算が得意。 |
ユーザー |
![]() |
提出日時 | 2025-06-12 15:36:38 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 739 bytes |
コンパイル時間 | 174 ms |
コンパイル使用メモリ | 82,232 KB |
実行使用メモリ | 54,364 KB |
最終ジャッジ日時 | 2025-06-12 15:37:50 |
合計ジャッジ時間 | 3,847 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 WA * 14 |
ソースコード
import math def compute_gcd(arr): current_gcd = abs(arr[0]) for num in arr[1:]: current_gcd = math.gcd(current_gcd, abs(num)) if current_gcd == 0: break return current_gcd def main(): import sys input = sys.stdin.read().split() idx = 0 N = int(input[idx]) idx += 1 K = int(input[idx]) idx += 1 A = list(map(int, input[idx:idx+N])) idx += N if K in A: print("Yes") return gcd = compute_gcd(A) if gcd == 0: if K == 0: print("Yes") else: print("No") else: if K % gcd == 0: print("Yes") else: print("No") if __name__ == "__main__": main()