結果

問題 No.10 +か×か
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-02-20 23:55:11
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 227 bytes
コンパイル時間 59 ms
コンパイル使用メモリ 11,576 KB
実行使用メモリ 53,916 KB
最終ジャッジ日時 2023-09-06 02:38:00
合計ジャッジ時間 8,233 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

gets
t=gets.to_i
a=gets.split.map &:to_i
d=(0..n=a.size).map{[]}
d[n][t]=1
n-=1
n.downto(2){|i|1.upto(t){|x|[x+a[i],x*a[i]].each{|y|d[i+1][y]&&d[i][x]=1}}}
x=a[0]
1.upto(n){|i|f=d[i+1][y=x+a[i]];print'+*'[f ?1:0];x=f ?y:x*a[i]}
0