結果

問題 No.269 見栄っ張りの募金活動
ユーザー しらっ亭しらっ亭
提出日時 2015-08-22 18:00:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 485 bytes
コンパイル時間 877 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 84,152 KB
最終ジャッジ日時 2023-09-25 16:13:45
合計ジャッジ時間 3,084 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,968 KB
testcase_01 AC 20 ms
8,928 KB
testcase_02 AC 16 ms
7,860 KB
testcase_03 AC 69 ms
18,472 KB
testcase_04 AC 199 ms
35,156 KB
testcase_05 AC 25 ms
10,092 KB
testcase_06 AC 91 ms
24,560 KB
testcase_07 AC 538 ms
84,152 KB
testcase_08 AC 21 ms
9,248 KB
testcase_09 AC 16 ms
7,868 KB
testcase_10 WA -
testcase_11 AC 54 ms
13,672 KB
testcase_12 AC 16 ms
7,808 KB
testcase_13 AC 85 ms
18,980 KB
testcase_14 AC 25 ms
9,288 KB
testcase_15 AC 76 ms
17,196 KB
testcase_16 AC 16 ms
7,772 KB
testcase_17 AC 16 ms
7,904 KB
testcase_18 AC 218 ms
39,876 KB
testcase_19 AC 84 ms
19,336 KB
testcase_20 AC 28 ms
10,112 KB
testcase_21 AC 27 ms
9,696 KB
testcase_22 AC 63 ms
15,956 KB
testcase_23 AC 35 ms
11,908 KB
testcase_24 AC 34 ms
10,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    MOD = 10 ** 9 + 7

    N, S, K = list(map(int, input().split()))
    S -= K * N * (N - 1) // 2

    if S <= 0:
        print(0)
        return

    dp = [[0 for s in range(20101)] for i in range(N + 1)]
    dp[0][0] = 1

    for i in range(1, N + 1):
        for j in range(S + 1):
            dp[i][j] = dp[i - 1][j] + dp[i][j - (N - i + 1)]
            if dp[i][j] > MOD:
                dp[i][j] -= MOD

    print(dp[N][S])


if __name__ == '__main__':
    solve()
0