結果

問題 No.1250 汝は倍数なりや?
ユーザー keymoonkeymoon
提出日時 2020-12-31 21:32:59
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 800 bytes
コンパイル時間 1,161 ms
コンパイル使用メモリ 104,960 KB
実行使用メモリ 37,888 KB
最終ジャッジ日時 2024-04-18 03:07:56
合計ジャッジ時間 5,167 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
19,200 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 28 ms
19,200 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 27 ms
19,200 KB
testcase_12 WA -
testcase_13 AC 27 ms
19,328 KB
testcase_14 AC 25 ms
18,816 KB
testcase_15 AC 24 ms
19,072 KB
testcase_16 AC 26 ms
19,200 KB
testcase_17 AC 25 ms
18,944 KB
testcase_18 AC 26 ms
19,328 KB
testcase_19 WA -
testcase_20 AC 25 ms
19,200 KB
testcase_21 AC 24 ms
19,200 KB
testcase_22 AC 26 ms
19,328 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 28 ms
19,712 KB
testcase_27 WA -
testcase_28 AC 33 ms
19,840 KB
testcase_29 WA -
testcase_30 AC 33 ms
19,456 KB
testcase_31 AC 30 ms
19,328 KB
testcase_32 AC 28 ms
19,840 KB
testcase_33 WA -
testcase_34 AC 66 ms
28,416 KB
testcase_35 AC 102 ms
36,608 KB
testcase_36 AC 102 ms
37,120 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 65 ms
28,416 KB
testcase_40 AC 74 ms
33,152 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 104 ms
37,120 KB
testcase_46 WA -
testcase_47 AC 78 ms
33,408 KB
testcase_48 AC 26 ms
19,200 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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