結果

問題 No.1250 汝は倍数なりや?
ユーザー keymoonkeymoon
提出日時 2020-12-31 21:33:28
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 148 ms / 1,000 ms
コード長 801 bytes
コンパイル時間 934 ms
コンパイル使用メモリ 104,832 KB
実行使用メモリ 38,016 KB
最終ジャッジ日時 2024-04-18 03:08:01
合計ジャッジ時間 4,781 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
19,200 KB
testcase_01 AC 28 ms
19,072 KB
testcase_02 AC 26 ms
18,816 KB
testcase_03 AC 25 ms
19,072 KB
testcase_04 AC 28 ms
19,072 KB
testcase_05 AC 26 ms
19,200 KB
testcase_06 AC 26 ms
19,200 KB
testcase_07 AC 25 ms
19,072 KB
testcase_08 AC 27 ms
19,072 KB
testcase_09 AC 25 ms
19,328 KB
testcase_10 AC 27 ms
19,200 KB
testcase_11 AC 24 ms
19,328 KB
testcase_12 AC 25 ms
19,328 KB
testcase_13 AC 27 ms
19,200 KB
testcase_14 AC 25 ms
19,200 KB
testcase_15 AC 27 ms
19,072 KB
testcase_16 AC 26 ms
19,072 KB
testcase_17 AC 28 ms
19,328 KB
testcase_18 AC 24 ms
19,072 KB
testcase_19 AC 25 ms
18,944 KB
testcase_20 AC 27 ms
19,200 KB
testcase_21 AC 28 ms
19,200 KB
testcase_22 AC 28 ms
19,328 KB
testcase_23 AC 30 ms
19,456 KB
testcase_24 AC 30 ms
19,584 KB
testcase_25 AC 33 ms
19,456 KB
testcase_26 AC 33 ms
19,456 KB
testcase_27 AC 31 ms
19,456 KB
testcase_28 AC 32 ms
19,456 KB
testcase_29 AC 34 ms
19,456 KB
testcase_30 AC 30 ms
19,456 KB
testcase_31 AC 29 ms
19,456 KB
testcase_32 AC 30 ms
19,456 KB
testcase_33 AC 145 ms
38,016 KB
testcase_34 AC 71 ms
28,416 KB
testcase_35 AC 115 ms
36,480 KB
testcase_36 AC 141 ms
36,864 KB
testcase_37 AC 111 ms
33,152 KB
testcase_38 AC 111 ms
33,792 KB
testcase_39 AC 76 ms
28,544 KB
testcase_40 AC 84 ms
33,152 KB
testcase_41 AC 128 ms
34,688 KB
testcase_42 AC 83 ms
25,984 KB
testcase_43 AC 148 ms
37,120 KB
testcase_44 AC 70 ms
26,240 KB
testcase_45 AC 113 ms
37,248 KB
testcase_46 AC 62 ms
23,680 KB
testcase_47 AC 86 ms
33,536 KB
testcase_48 AC 24 ms
19,200 KB
testcase_49 AC 29 ms
19,200 KB
testcase_50 AC 26 ms
19,200 KB
testcase_51 AC 24 ms
18,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        var nh = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = nh[0];
        long h = nh[1];
        foreach (var a in Console.ReadLine().Split().Select(long.Parse)) h /= GCD(h, Abs(a));
        Console.WriteLine(h == 1 ? "YES" : "NO");
    }

    static long GCD(long a, long b)
    {
        while (true)
        {
            if (b == 0) return a;
            a %= b;
            if (a == 0) return b;
            b %= a;
        }
    }
}
0