結果

問題 No.269 見栄っ張りの募金活動
ユーザー ayaoniayaoni
提出日時 2020-10-09 17:36:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 102 ms / 5,000 ms
コード長 456 bytes
コンパイル時間 1,016 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 92,048 KB
最終ジャッジ日時 2023-09-27 12:44:19
合計ジャッジ時間 3,425 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
71,388 KB
testcase_01 AC 59 ms
71,200 KB
testcase_02 AC 61 ms
71,348 KB
testcase_03 AC 74 ms
76,248 KB
testcase_04 AC 83 ms
82,040 KB
testcase_05 AC 70 ms
76,196 KB
testcase_06 AC 63 ms
71,208 KB
testcase_07 AC 102 ms
92,048 KB
testcase_08 AC 59 ms
71,424 KB
testcase_09 AC 63 ms
71,556 KB
testcase_10 AC 63 ms
71,508 KB
testcase_11 AC 68 ms
76,356 KB
testcase_12 AC 59 ms
71,556 KB
testcase_13 AC 68 ms
76,016 KB
testcase_14 AC 66 ms
76,636 KB
testcase_15 AC 66 ms
76,016 KB
testcase_16 AC 60 ms
71,456 KB
testcase_17 AC 58 ms
71,176 KB
testcase_18 AC 76 ms
76,252 KB
testcase_19 AC 68 ms
76,260 KB
testcase_20 AC 68 ms
76,332 KB
testcase_21 AC 65 ms
75,984 KB
testcase_22 AC 69 ms
76,244 KB
testcase_23 AC 64 ms
76,292 KB
testcase_24 AC 65 ms
76,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N,S,K = MI()
mod = 10**9+7

S -= K*(N*(N-1)//2)
if S < 0:
    print(0)
else:
    dp = [[0]*(S+1) for _ in range(N+1)]  # dp[i][j] = jをi個に分割する方法
    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:
                dp[i][j] += dp[i][j-i]
            dp[i][j] %= mod
    print(dp[N][S])
0