結果

問題 No.1250 汝は倍数なりや?
ユーザー nak2yoshi
提出日時 2020-10-09 23:38:35
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 487 bytes
コンパイル時間 1,866 ms
コンパイル使用メモリ 178,080 KB
実行使用メモリ 24,956 KB
最終ジャッジ日時 2024-06-22 09:25:13
合計ジャッジ時間 4,516 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 1 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    auto input = readln.split.to!(long[]);
    auto N = input[0], H = input[1];
    if (H == 1) {
        writeln("YES");
        return;
    }
    auto A = readln.split.to!(long[]);

    if (A.count!"a == 0" > 0) {
        writeln("NO");
        return;
    }

    if (A.count!(a => a % H == 0) > 0) {
        writeln("YES");
        return;
    }

    BigInt P = 1;
    foreach (e; A[0 .. N]) {
        P *= e;
    }
    writeln(P % H == 0 ? "YES" : "NO");
}
0