結果

問題 No.269 見栄っ張りの募金活動
ユーザー hiremasahiremasa
提出日時 2020-09-11 19:44:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 5,000 ms
コード長 359 bytes
コンパイル時間 2,245 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 92,136 KB
最終ジャッジ日時 2023-08-27 05:07:25
合計ジャッジ時間 5,160 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,592 KB
testcase_01 AC 73 ms
71,400 KB
testcase_02 AC 73 ms
71,348 KB
testcase_03 AC 80 ms
76,164 KB
testcase_04 AC 91 ms
81,856 KB
testcase_05 AC 77 ms
75,860 KB
testcase_06 AC 74 ms
71,612 KB
testcase_07 AC 111 ms
92,136 KB
testcase_08 AC 72 ms
71,308 KB
testcase_09 AC 73 ms
71,504 KB
testcase_10 AC 72 ms
71,260 KB
testcase_11 AC 80 ms
76,296 KB
testcase_12 AC 74 ms
71,644 KB
testcase_13 AC 84 ms
76,208 KB
testcase_14 AC 78 ms
76,736 KB
testcase_15 AC 81 ms
76,112 KB
testcase_16 AC 71 ms
71,368 KB
testcase_17 AC 73 ms
71,500 KB
testcase_18 AC 88 ms
76,224 KB
testcase_19 AC 82 ms
76,296 KB
testcase_20 AC 79 ms
76,128 KB
testcase_21 AC 78 ms
76,036 KB
testcase_22 AC 81 ms
76,280 KB
testcase_23 AC 78 ms
76,232 KB
testcase_24 AC 81 ms
76,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#https://yukicoder.me/problems/no/269
N, S, K = map(int, input().split())
M=S-K*N*(N-1)//2
#dp[i][j] :=jをi分割の総数
if M < 0:
    print(0)
else:
	dp=[[0]*(M+1) for _ in range(N+1)]
	dp[0][0]=1
	for i in range(N+1):
		for j in range(M+1):
			if j-i>=0:
				dp[i][j]=(dp[i-1][j]+dp[i][j-i])%(10**9+7)
			else:
				dp[i][j]=dp[i-1][j]
	print(dp[-1][-1])
0