結果

問題 No.269 見栄っ張りの募金活動
ユーザー neko0774neko0774
提出日時 2023-02-17 18:46:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,164 ms / 5,000 ms
コード長 366 bytes
コンパイル時間 971 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 360,216 KB
最終ジャッジ日時 2023-09-26 16:39:22
合計ジャッジ時間 8,237 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,176 KB
testcase_01 AC 74 ms
71,068 KB
testcase_02 AC 73 ms
70,992 KB
testcase_03 AC 137 ms
92,296 KB
testcase_04 AC 636 ms
170,380 KB
testcase_05 AC 85 ms
76,288 KB
testcase_06 AC 76 ms
71,128 KB
testcase_07 AC 2,164 ms
360,216 KB
testcase_08 AC 75 ms
70,760 KB
testcase_09 AC 74 ms
71,312 KB
testcase_10 AC 73 ms
70,896 KB
testcase_11 AC 177 ms
101,192 KB
testcase_12 AC 74 ms
71,056 KB
testcase_13 AC 227 ms
115,808 KB
testcase_14 AC 100 ms
83,620 KB
testcase_15 AC 229 ms
111,488 KB
testcase_16 AC 75 ms
71,096 KB
testcase_17 AC 74 ms
71,348 KB
testcase_18 AC 679 ms
169,528 KB
testcase_19 AC 218 ms
111,632 KB
testcase_20 AC 105 ms
84,000 KB
testcase_21 AC 108 ms
86,960 KB
testcase_22 AC 169 ms
96,596 KB
testcase_23 AC 90 ms
78,972 KB
testcase_24 AC 119 ms
91,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for n in range(N):
    S -= n*K

P = dict()
for n in range(S+1):
    for k in range(1, N+1):
        if n==0 or k==1:
            P[(n, k)] = 1
        elif n<k: 
            P[(n, k)] = P[(n, n)]
        else:
            P[(n, k)] = P[(n, k-1)]+P[(n-k, k)]
        P[(n, k)] %= mod

print(0 if S<0 else P[(S, N)])
0