結果
問題 |
No.1538 引きこもりさんは引き算が得意。
|
ユーザー |
![]() |
提出日時 | 2025-06-12 15:33:44 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 707 bytes |
コンパイル時間 | 282 ms |
コンパイル使用メモリ | 82,448 KB |
実行使用メモリ | 54,608 KB |
最終ジャッジ日時 | 2025-06-12 15:35:10 |
合計ジャッジ時間 | 3,640 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 == 1: 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 N == 0: print("No") return d = compute_gcd(A) if d == 0: if K ==0: print("Yes") else: print("No") return if K % d ==0: print("Yes") else: print("No") if __name__ == "__main__": main()