結果

問題 No.269 見栄っ張りの募金活動
ユーザー smz_8110smz_8110
提出日時 2018-08-17 16:55:17
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 1,344 ms / 5,000 ms
コード長 900 bytes
コンパイル時間 4,157 ms
コンパイル使用メモリ 104,636 KB
実行使用メモリ 36,152 KB
最終ジャッジ日時 2023-09-23 01:33:42
合計ジャッジ時間 7,394 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,728 KB
testcase_01 AC 58 ms
20,728 KB
testcase_02 AC 57 ms
22,800 KB
testcase_03 AC 78 ms
20,756 KB
testcase_04 AC 230 ms
25,944 KB
testcase_05 AC 56 ms
20,740 KB
testcase_06 AC 57 ms
20,648 KB
testcase_07 AC 1,344 ms
36,152 KB
testcase_08 AC 58 ms
20,816 KB
testcase_09 AC 58 ms
20,820 KB
testcase_10 AC 56 ms
20,732 KB
testcase_11 AC 67 ms
21,412 KB
testcase_12 AC 57 ms
20,808 KB
testcase_13 AC 96 ms
22,004 KB
testcase_14 AC 58 ms
20,776 KB
testcase_15 AC 85 ms
23,816 KB
testcase_16 AC 57 ms
20,820 KB
testcase_17 AC 58 ms
22,780 KB
testcase_18 AC 373 ms
25,768 KB
testcase_19 AC 101 ms
21,768 KB
testcase_20 AC 60 ms
20,832 KB
testcase_21 AC 59 ms
20,724 KB
testcase_22 AC 78 ms
21,344 KB
testcase_23 AC 59 ms
20,876 KB
testcase_24 AC 60 ms
20,720 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
{
    const int A = 1000000007;
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');
        var n = int.Parse(input[0]);
        var s = int.Parse(input[1]);
        var k = int.Parse(input[2]);

        int m = s - (n - 1) * n * k / 2;
        int c = 0;
        if (m == 0) { c = 1; }
        else
        {
            for (var l = 1; l <= n && l <= m; l++)
            {
                long[] t = new long[m - l + 2];
                for (var i = 0; i < t.Length; i++) { t[i] = 1; }
                for (var i = 2; i <= l; i++)
                {
                    for (var j = i; j <= m - l; j++)
                    {
                        t[j] = (t[j] + t[j - i]) % A;
                    }
                }
                c = (int)((c + t[m - l]) % A);
            }
        }
        Console.WriteLine(c);
    }
}

0