結果

問題 No.269 見栄っ張りの募金活動
ユーザー urutomurutom
提出日時 2017-04-18 19:48:02
言語 Ruby
(3.3.0)
結果
AC  
実行時間 316 ms / 5,000 ms
コード長 216 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 11,284 KB
実行使用メモリ 30,852 KB
最終ジャッジ日時 2023-09-23 01:22:59
合計ジャッジ時間 3,841 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,216 KB
testcase_01 AC 80 ms
15,216 KB
testcase_02 AC 80 ms
15,248 KB
testcase_03 AC 86 ms
15,756 KB
testcase_04 AC 164 ms
20,616 KB
testcase_05 AC 79 ms
15,200 KB
testcase_06 AC 79 ms
15,112 KB
testcase_07 AC 316 ms
30,852 KB
testcase_08 AC 78 ms
15,328 KB
testcase_09 AC 80 ms
15,076 KB
testcase_10 AC 82 ms
15,076 KB
testcase_11 AC 97 ms
16,340 KB
testcase_12 AC 81 ms
15,148 KB
testcase_13 AC 107 ms
16,904 KB
testcase_14 AC 83 ms
15,548 KB
testcase_15 AC 105 ms
16,644 KB
testcase_16 AC 81 ms
15,212 KB
testcase_17 AC 80 ms
15,100 KB
testcase_18 AC 162 ms
20,352 KB
testcase_19 AC 104 ms
16,900 KB
testcase_20 AC 84 ms
15,292 KB
testcase_21 AC 85 ms
15,340 KB
testcase_22 AC 96 ms
16,304 KB
testcase_23 AC 81 ms
15,340 KB
testcase_24 AC 87 ms
15,656 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

M=10**9+7
n,s,k=gets.split.map(&:to_i)
s-=k*n*(n-1)/2
if s<0
	p 0
	exit
end

dp=Array.new(n+s+9,1)
w=1
(n-1).times{
	temp=Array.new(n+s+9,0)
	w+=1
	(s+1).times{|i|
		temp[i]=(temp[i-w]+dp[i])%M
	}
	dp=temp
}

p dp[s]
0