結果

問題 No.864 四方演算
ユーザー bayashiko_rbayashiko_r
提出日時 2019-08-16 22:22:06
言語 C#(csc)
(csc 3.9.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 987 bytes
コンパイル時間 2,080 ms
コンパイル使用メモリ 108,636 KB
実行使用メモリ 24,036 KB
最終ジャッジ日時 2023-10-24 23:00:49
合計ジャッジ時間 3,982 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 26 ms
24,036 KB
testcase_03 AC 37 ms
24,036 KB
testcase_04 AC 39 ms
24,036 KB
testcase_05 AC 34 ms
24,036 KB
testcase_06 AC 38 ms
24,036 KB
testcase_07 AC 37 ms
24,036 KB
testcase_08 AC 35 ms
24,036 KB
testcase_09 AC 30 ms
24,036 KB
testcase_10 AC 30 ms
24,036 KB
testcase_11 AC 26 ms
24,036 KB
testcase_12 AC 35 ms
24,036 KB
testcase_13 AC 32 ms
24,036 KB
testcase_14 AC 26 ms
24,036 KB
testcase_15 AC 41 ms
24,036 KB
testcase_16 AC 37 ms
24,036 KB
testcase_17 AC 38 ms
24,036 KB
testcase_18 AC 36 ms
24,036 KB
testcase_19 AC 33 ms
24,036 KB
testcase_20 AC 39 ms
24,036 KB
testcase_21 AC 36 ms
24,036 KB
testcase_22 AC 34 ms
24,036 KB
testcase_23 AC 25 ms
24,036 KB
testcase_24 AC 34 ms
24,036 KB
testcase_25 AC 28 ms
24,036 KB
testcase_26 AC 35 ms
24,036 KB
testcase_27 AC 23 ms
24,036 KB
testcase_28 AC 23 ms
24,036 KB
testcase_29 AC 23 ms
24,036 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class Program {
    static void Main(string[] args) {
        //入力
        long N = long.Parse(Console.ReadLine());
        long K = long.Parse(Console.ReadLine());

        //回答となるペア数
        long pair = 0;

        for (long i = 2; i <= Math.Min(2 * N, Math.Sqrt(K)); i++) {
            if (K % i != 0) {
                continue;
            }

            if ((K / i) > (2 * N)) {
                continue;
            }

            long combi_ac;
            long combi_bd;

            //a,cの組み合わせ
            if (i >= N + 2) {
                combi_ac = 2 * N - i + 1;
            } else {
                combi_ac = i - 1;
            }

            //b,dの組み合わせ
            if ((K / i) >= N + 2) {
                combi_bd = 2 * N - (K / i) + 1;
            } else {
                combi_bd = (K / i) - 1;
            }

            pair += combi_ac * combi_bd * 2;
        } 

        Console.WriteLine(pair);
    }
}
0