結果

問題 No.269 見栄っ張りの募金活動
ユーザー rpy3cpprpy3cpp
提出日時 2015-08-21 23:10:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 542 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 88,356 KB
最終ジャッジ日時 2023-09-25 15:22:59
合計ジャッジ時間 7,625 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,236 KB
testcase_01 AC 71 ms
71,468 KB
testcase_02 AC 70 ms
71,424 KB
testcase_03 AC 325 ms
87,348 KB
testcase_04 TLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(N, S):
    global dp
    mod = 10**9 + 7
    if S < 0:
        return 0
    if S == 0:
        return 1
    dp = [[-1] * (S + 1) for i in range(N + 1)]
    for n in range(N + 1):
        dp[n][0] = 1
    for s in range(S + 1):
        dp[1][s] = 1
    return dfs(N, S, mod)

def dfs(n, s, mod):
    global dp
    if dp[n][s] != -1:
        return dp[n][s]
    dp[n][s] = sum(dfs(n-1, ss, mod) for ss in range(s, -1, -n)) % mod
    return dp[n][s]
    

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