結果

問題 No.2417 Div Count
ユーザー bluemeganebluemegane
提出日時 2023-08-19 10:18:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 797 bytes
コンパイル時間 1,578 ms
コンパイル使用メモリ 65,236 KB
実行使用メモリ 22,796 KB
最終ジャッジ日時 2023-08-19 10:18:18
合計ジャッジ時間 6,268 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
22,692 KB
testcase_01 AC 57 ms
22,624 KB
testcase_02 AC 56 ms
22,732 KB
testcase_03 AC 62 ms
20,680 KB
testcase_04 AC 57 ms
22,668 KB
testcase_05 AC 57 ms
22,768 KB
testcase_06 AC 57 ms
22,624 KB
testcase_07 AC 56 ms
20,744 KB
testcase_08 AC 56 ms
18,648 KB
testcase_09 AC 57 ms
20,808 KB
testcase_10 AC 57 ms
20,588 KB
testcase_11 AC 58 ms
20,808 KB
testcase_12 AC 57 ms
20,644 KB
testcase_13 AC 57 ms
20,588 KB
testcase_14 AC 58 ms
20,716 KB
testcase_15 AC 57 ms
20,708 KB
testcase_16 AC 56 ms
22,660 KB
testcase_17 AC 57 ms
20,696 KB
testcase_18 AC 57 ms
18,544 KB
testcase_19 AC 58 ms
18,548 KB
testcase_20 AC 58 ms
20,760 KB
testcase_21 AC 57 ms
20,576 KB
testcase_22 AC 57 ms
20,652 KB
testcase_23 AC 57 ms
20,536 KB
testcase_24 AC 57 ms
20,680 KB
testcase_25 AC 58 ms
22,660 KB
testcase_26 AC 57 ms
22,596 KB
testcase_27 AC 58 ms
20,656 KB
testcase_28 AC 57 ms
20,656 KB
testcase_29 AC 57 ms
18,616 KB
testcase_30 AC 58 ms
22,736 KB
testcase_31 AC 57 ms
22,796 KB
testcase_32 AC 62 ms
20,588 KB
testcase_33 AC 58 ms
20,652 KB
testcase_34 AC 58 ms
20,640 KB
testcase_35 AC 64 ms
22,724 KB
testcase_36 AC 61 ms
20,696 KB
testcase_37 AC 60 ms
20,620 KB
testcase_38 AC 69 ms
22,668 KB
testcase_39 AC 62 ms
20,556 KB
testcase_40 AC 60 ms
22,688 KB
testcase_41 AC 59 ms
20,592 KB
testcase_42 AC 57 ms
22,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using static System.Math;
using System.Collections.Generic;
using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = long.Parse(line[0]);
        var k = long.Parse(line[1]);
        getAns(n, k);
    }
    static void getAns(long n, long k)
    {
        var c = getDiv(n - k);
        var ans = 0;
        foreach (var x in c)
            if (n % x == k) ans++;
        Console.WriteLine(ans);
    }
    public static List<long> getDiv(long n)
    {
        var ans = new List<long>();
        for (int i = 1; i <= Sqrt(n); i++)
        {
            if (n % i == 0)
            {
                ans.Add(i);
                if (n != i * i) ans.Add(n / i);
            }
        }
        return ans;
    }
}
0