結果

問題 No.269 見栄っ張りの募金活動
ユーザー tonyu0tonyu0
提出日時 2021-01-28 16:11:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 143 ms / 5,000 ms
コード長 435 bytes
コンパイル時間 1,080 ms
コンパイル使用メモリ 86,556 KB
実行使用メモリ 91,100 KB
最終ジャッジ日時 2023-09-08 07:02:44
合計ジャッジ時間 4,704 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,836 KB
testcase_01 AC 72 ms
70,704 KB
testcase_02 AC 75 ms
71,052 KB
testcase_03 AC 126 ms
75,204 KB
testcase_04 AC 102 ms
81,024 KB
testcase_05 AC 79 ms
75,104 KB
testcase_06 AC 74 ms
70,868 KB
testcase_07 AC 143 ms
91,100 KB
testcase_08 AC 73 ms
70,852 KB
testcase_09 AC 74 ms
70,920 KB
testcase_10 AC 74 ms
71,048 KB
testcase_11 AC 84 ms
75,312 KB
testcase_12 AC 72 ms
70,924 KB
testcase_13 AC 87 ms
75,312 KB
testcase_14 AC 85 ms
75,664 KB
testcase_15 AC 92 ms
75,488 KB
testcase_16 AC 75 ms
70,848 KB
testcase_17 AC 76 ms
70,920 KB
testcase_18 AC 100 ms
75,320 KB
testcase_19 AC 89 ms
75,248 KB
testcase_20 AC 84 ms
75,444 KB
testcase_21 AC 81 ms
75,444 KB
testcase_22 AC 87 ms
75,520 KB
testcase_23 AC 79 ms
75,248 KB
testcase_24 AC 81 ms
75,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, s, k = map(int, input().split())
# 0 + k * (n - 1)
# k * n * (n - 1) // 2
s -= k * n * (n - 1) // 2
if s < 0:
    print(0)
    exit()
mod = 10 ** 9 + 7
dp = [[0] * (s + 1) for _ 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]
        if j - i >= 0:
            dp[i][j] += dp[i][j - i]
            if dp[i][j] >= mod:
                dp[i][j] -= mod
print(dp[n][s])
0