結果

問題 No.10 +か×か
ユーザー %20%20
提出日時 2017-07-09 18:43:45
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 326 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 213,632 KB
最終ジャッジ日時 2024-04-16 11:11:39
合計ジャッジ時間 7,087 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
12,160 KB
testcase_01 AC 84 ms
12,160 KB
testcase_02 AC 85 ms
12,160 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N=gets.to_i
T=gets.to_i
A=gets.split.map &:to_i
d=Array.new(N).map{Array.new(T)}
d[0][A[0]]=''
1.upto(N-1){|i|
	1.upto(T){|v|
		d[i][v*A[i]]=d[i-1][v]+'*'if d[i-1][v] && v*A[i]<=T && d[i-1][v]+'*'>(d[i][v*A[i]]||'')
		d[i][v+A[i]]=d[i-1][v]+'+'if d[i-1][v] && v+A[i]<=T && d[i-1][v]+'+'>(d[i][v+A[i]]||'')
	}
}
puts d[N-1][T]
0