結果

問題 No.882 約数倍数
ユーザー curryudon08curryudon08
提出日時 2020-07-03 17:13:34
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 56 ms / 500 ms
コード長 919 bytes
コンパイル時間 1,965 ms
コンパイル使用メモリ 104,292 KB
実行使用メモリ 22,820 KB
最終ジャッジ日時 2023-10-14 23:46:21
合計ジャッジ時間 3,818 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
20,696 KB
testcase_01 AC 56 ms
22,668 KB
testcase_02 AC 55 ms
20,848 KB
testcase_03 AC 55 ms
20,688 KB
testcase_04 AC 56 ms
20,752 KB
testcase_05 AC 56 ms
20,696 KB
testcase_06 AC 55 ms
22,820 KB
testcase_07 AC 55 ms
20,636 KB
testcase_08 AC 54 ms
20,720 KB
testcase_09 AC 55 ms
20,696 KB
testcase_10 AC 55 ms
22,728 KB
testcase_11 AC 55 ms
20,636 KB
testcase_12 AC 55 ms
20,856 KB
testcase_13 AC 53 ms
20,768 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.Generic;

namespace _0882
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var a = long.Parse(_[0]);
            var b = long.Parse(_[1]);

            var l = Divisor(a);
            var f = false;
            foreach(var x in l){
                if(x % b == 0){
                    f = true;
                    break;
                }
            }

            Console.WriteLine(f ? "YES" : "NO");
        }

        static List<long> Divisor(long n){
            var l = new List<long>();
            for(var i = 1L; i * i <= n; i++){
                if(n % i == 0){
                    l.Add(i);
                    if(i * i != n){
                        l.Add(n / i);
                    }
                }
            }
            l.Sort();
            return l;
        }
    }
}
0