結果

問題 No.269 見栄っ張りの募金活動
ユーザー shobonvipshobonvip
提出日時 2022-07-29 20:28:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 5,000 ms
コード長 469 bytes
コンパイル時間 635 ms
コンパイル使用メモリ 86,736 KB
実行使用メモリ 91,140 KB
最終ジャッジ日時 2023-09-26 17:18:46
合計ジャッジ時間 3,933 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,248 KB
testcase_01 AC 71 ms
71,504 KB
testcase_02 AC 80 ms
76,304 KB
testcase_03 AC 85 ms
76,432 KB
testcase_04 AC 98 ms
76,564 KB
testcase_05 AC 82 ms
76,272 KB
testcase_06 AC 73 ms
71,264 KB
testcase_07 AC 148 ms
91,140 KB
testcase_08 AC 74 ms
71,192 KB
testcase_09 AC 105 ms
76,236 KB
testcase_10 AC 81 ms
76,204 KB
testcase_11 AC 94 ms
76,612 KB
testcase_12 AC 100 ms
76,516 KB
testcase_13 AC 92 ms
76,304 KB
testcase_14 AC 86 ms
76,788 KB
testcase_15 AC 89 ms
76,460 KB
testcase_16 AC 98 ms
76,520 KB
testcase_17 AC 86 ms
76,524 KB
testcase_18 AC 128 ms
88,460 KB
testcase_19 AC 89 ms
76,512 KB
testcase_20 AC 85 ms
76,672 KB
testcase_21 AC 86 ms
76,424 KB
testcase_22 AC 85 ms
76,464 KB
testcase_23 AC 84 ms
76,556 KB
testcase_24 AC 87 ms
76,732 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
while j >= 0:
	ans = (ans + dp[j][n-1]) % mod
	j -= n

print(ans)
0