結果

問題 No.269 見栄っ張りの募金活動
ユーザー ああいいああいい
提出日時 2022-03-02 13:48:27
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 451 bytes
コンパイル時間 1,349 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 86,080 KB
最終ジャッジ日時 2023-09-23 07:04:49
合計ジャッジ時間 8,724 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,340 KB
testcase_01 AC 77 ms
71,448 KB
testcase_02 AC 76 ms
71,324 KB
testcase_03 AC 113 ms
76,256 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 #

N,S,K = map(int,input().split())
D = K * (N-1) * N // 2
import sys
if S < D:
    print(0)
    exit()
S -= D
dp = [[0] * (S +1) for _ in range(N)]
i = 0
P = 10 ** 9 + 7
while i * N <= S:
    dp[0][i * N] += 1
    i += 1
for i in range(1,N):
    for j in range(S+1):
        k = j
        while k <= S:
            dp[i][k] += dp[i-1][j]
            dp[i][k] %= P
            k += N - i
    for j in range(S + 1):
        dp[i][j] %= P
print(dp[-1][S])
0