結果

問題 No.269 見栄っ張りの募金活動
ユーザー shobonvipshobonvip
提出日時 2022-07-29 20:33:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 441 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 91,132 KB
最終ジャッジ日時 2023-09-26 17:25:23
合計ジャッジ時間 3,870 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,264 KB
testcase_01 AC 75 ms
71,408 KB
testcase_02 AC 83 ms
76,204 KB
testcase_03 AC 88 ms
76,352 KB
testcase_04 AC 97 ms
76,852 KB
testcase_05 AC 81 ms
76,280 KB
testcase_06 AC 73 ms
71,124 KB
testcase_07 AC 147 ms
91,132 KB
testcase_08 AC 75 ms
71,280 KB
testcase_09 AC 105 ms
76,236 KB
testcase_10 AC 82 ms
76,452 KB
testcase_11 AC 92 ms
76,488 KB
testcase_12 AC 101 ms
76,448 KB
testcase_13 AC 91 ms
76,292 KB
testcase_14 AC 85 ms
76,544 KB
testcase_15 AC 89 ms
76,540 KB
testcase_16 AC 99 ms
76,544 KB
testcase_17 AC 86 ms
76,428 KB
testcase_18 AC 125 ms
88,144 KB
testcase_19 AC 89 ms
76,448 KB
testcase_20 AC 84 ms
76,456 KB
testcase_21 AC 86 ms
76,720 KB
testcase_22 AC 86 ms
76,512 KB
testcase_23 AC 83 ms
76,412 KB
testcase_24 AC 83 ms
76,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7

n,s,k = map(int,input().split())

#dp[i][j] : i番目までつかって, 今
dp = [[0] * (n+1) for i in range(s+1)]
dp[0][0] = 1

for i in range(1,s+1):
	for j in range(1,n+1):
		if i-j >= 0:
			dp[i][j] = (dp[i-1][j-1] + dp[i-j][j]) % mod

for i in range(s+1):
	for j in range(1,n+1):
		dp[i][j] = (dp[i][j] + dp[i][j-1]) % mod

#print(*dp,sep="\n")

j = s - n * (n-1) // 2 * k
ans = 0
if j >= 0:
	ans = dp[j][n]
print(ans)
0