結果

問題 No.1538 引きこもりさんは引き算が得意。
ユーザー lam6er
提出日時 2025-03-20 20:28:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 532 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 82,328 KB
実行使用メモリ 54,540 KB
最終ジャッジ日時 2025-03-20 20:29:09
合計ジャッジ時間 3,744 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def main():
    import sys
    input = sys.stdin.read().split()
    n = int(input[0])
    k = int(input[1])
    a = list(map(int, input[2:2+n]))
    
    if k in a:
        print("Yes")
        return
    
    current_gcd = abs(a[0])
    for num in a[1:]:
        current_gcd = math.gcd(current_gcd, abs(num))
    
    if current_gcd == 0:
        print("No" if k != 0 else "Yes")
        return
    
    if k % current_gcd != 0:
        print("No")
    else:
        print("Yes")

if __name__ == "__main__":
    main()
0