結果

問題 No.269 見栄っ張りの募金活動
ユーザー urutomurutom
提出日時 2017-04-18 19:38:48
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 212 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 11,384 KB
実行使用メモリ 46,916 KB
最終ジャッジ日時 2023-09-26 13:25:08
合計ジャッジ時間 3,840 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,028 KB
testcase_01 AC 81 ms
15,152 KB
testcase_02 AC 82 ms
15,244 KB
testcase_03 AC 89 ms
15,984 KB
testcase_04 AC 170 ms
26,380 KB
testcase_05 AC 82 ms
15,304 KB
testcase_06 RE -
testcase_07 AC 339 ms
46,916 KB
testcase_08 AC 84 ms
15,284 KB
testcase_09 AC 82 ms
15,084 KB
testcase_10 RE -
testcase_11 AC 101 ms
17,392 KB
testcase_12 AC 82 ms
15,108 KB
testcase_13 AC 111 ms
18,856 KB
testcase_14 AC 86 ms
15,648 KB
testcase_15 AC 107 ms
18,328 KB
testcase_16 AC 84 ms
15,348 KB
testcase_17 AC 82 ms
15,156 KB
testcase_18 AC 167 ms
25,900 KB
testcase_19 AC 106 ms
18,328 KB
testcase_20 AC 85 ms
15,652 KB
testcase_21 AC 86 ms
15,812 KB
testcase_22 AC 97 ms
17,272 KB
testcase_23 AC 82 ms
15,536 KB
testcase_24 AC 89 ms
16,160 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(2*s,1)
w=1
(n-1).times{
	temp=Array.new(2*s,0)
	w+=1
	(s+1).times{|i|
		temp[i]=(temp[i-w]+dp[i])%M
	}
	dp=temp
}

p dp[s]
0