結果

問題 No.269 見栄っ張りの募金活動
ユーザー tmsausatmsausa
提出日時 2018-11-14 20:27:50
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 453 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 81,340 KB
最終ジャッジ日時 2023-08-26 01:12:00
合計ジャッジ時間 11,970 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
71,496 KB
testcase_01 AC 62 ms
71,344 KB
testcase_02 AC 59 ms
71,280 KB
testcase_03 AC 86 ms
76,208 KB
testcase_04 AC 4,365 ms
76,884 KB
testcase_05 AC 72 ms
76,204 KB
testcase_06 AC 63 ms
71,028 KB
testcase_07 TLE -
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 #

MOD = 10**9 + 7
N, S, K = map(int, input().split())

min_donation = (N - 1) * K * N // 2
if min_donation > S:
    print(0)
    exit(0)
elif min_donation == S:
    print(1)
    exit(0)

S -= min_donation
dp = [0] * (S + 1)
dp[0] = 1
for i in range(N):
    for j in reversed(range(S + 1)):
        a = 1
        while j + a * (N - i) < S + 1:
            dp[j + a * (N - i)] += dp[j]
            dp[j + a * (N - i)] %= MOD
            a += 1
print(dp[S])
0