結果

問題 No.864 四方演算
ユーザー bayashiko_rbayashiko_r
提出日時 2019-08-16 22:19:34
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 958 bytes
コンパイル時間 2,984 ms
コンパイル使用メモリ 105,928 KB
実行使用メモリ 23,828 KB
最終ジャッジ日時 2023-10-24 00:49:38
合計ジャッジ時間 3,573 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
23,828 KB
testcase_01 AC 35 ms
23,828 KB
testcase_02 AC 26 ms
23,828 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 <= 2 * N; 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;
        }

        Console.WriteLine(pair);
    }
}
0