結果

問題 No.864 四方演算
ユーザー bayashiko_rbayashiko_r
提出日時 2019-08-16 22:22:06
言語 C#
(csc 3.9.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 987 bytes
コンパイル時間 1,860 ms
使用メモリ 22,940 KB
最終ジャッジ日時 2022-11-23 13:24:22
合計ジャッジ時間 5,032 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 52 ms
20,876 KB
testcase_03 AC 64 ms
22,892 KB
testcase_04 AC 67 ms
20,852 KB
testcase_05 AC 61 ms
20,948 KB
testcase_06 AC 66 ms
20,784 KB
testcase_07 AC 65 ms
22,940 KB
testcase_08 AC 61 ms
20,808 KB
testcase_09 AC 57 ms
20,864 KB
testcase_10 AC 56 ms
20,968 KB
testcase_11 AC 53 ms
20,784 KB
testcase_12 AC 61 ms
21,000 KB
testcase_13 AC 59 ms
20,868 KB
testcase_14 AC 52 ms
20,792 KB
testcase_15 AC 67 ms
20,876 KB
testcase_16 AC 62 ms
20,816 KB
testcase_17 AC 64 ms
20,780 KB
testcase_18 AC 62 ms
20,780 KB
testcase_19 AC 61 ms
20,868 KB
testcase_20 AC 66 ms
20,936 KB
testcase_21 AC 63 ms
20,860 KB
testcase_22 AC 59 ms
18,900 KB
testcase_23 AC 52 ms
20,940 KB
testcase_24 AC 59 ms
20,884 KB
testcase_25 AC 56 ms
21,004 KB
testcase_26 AC 62 ms
20,904 KB
testcase_27 AC 51 ms
18,852 KB
testcase_28 AC 51 ms
20,904 KB
testcase_29 AC 51 ms
20,852 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