結果

問題 No.269 見栄っ張りの募金活動
ユーザー tassei903tassei903
提出日時 2022-12-14 09:36:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 67 ms / 5,000 ms
コード長 699 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 82,616 KB
実行使用メモリ 78,028 KB
最終ジャッジ日時 2024-04-25 14:43:54
合計ジャッジ時間 2,167 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,640 KB
testcase_01 AC 36 ms
52,684 KB
testcase_02 AC 41 ms
60,616 KB
testcase_03 AC 43 ms
62,272 KB
testcase_04 AC 54 ms
69,252 KB
testcase_05 AC 37 ms
59,448 KB
testcase_06 AC 35 ms
53,928 KB
testcase_07 AC 67 ms
78,028 KB
testcase_08 AC 34 ms
52,768 KB
testcase_09 AC 54 ms
70,424 KB
testcase_10 AC 38 ms
59,872 KB
testcase_11 AC 43 ms
63,796 KB
testcase_12 AC 50 ms
67,528 KB
testcase_13 AC 46 ms
64,260 KB
testcase_14 AC 40 ms
62,460 KB
testcase_15 AC 45 ms
63,912 KB
testcase_16 AC 49 ms
67,040 KB
testcase_17 AC 45 ms
64,348 KB
testcase_18 AC 60 ms
72,752 KB
testcase_19 AC 46 ms
65,456 KB
testcase_20 AC 43 ms
62,376 KB
testcase_21 AC 39 ms
61,144 KB
testcase_22 AC 45 ms
62,548 KB
testcase_23 AC 43 ms
62,456 KB
testcase_24 AC 43 ms
61,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
n,s,k = na()
dp = [0] * (s+1)
dp[0] = 1
mod = 10**9+7
for i in range(n):
    ndp = [0]*(s+1)
    ndp, dp = dp, ndp
    nk = k if i else 0
    for j in range(s+1):
        if j - (n - i) >= 0:
            dp[j] += dp[j-(n-i)]
        if j - nk*(n-i) >= 0:
            dp[j] += ndp[j-nk*(n-i)]
            dp[j] %= mod
    #print(dp)
print(dp[-1])
0