結果

問題 No.10 +か×か
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-02-21 00:00:09
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,684 ms / 5,000 ms
コード長 227 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 11,224 KB
実行使用メモリ 53,980 KB
最終ジャッジ日時 2023-08-21 06:10:55
合計ジャッジ時間 8,011 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,340 KB
testcase_01 AC 82 ms
15,136 KB
testcase_02 AC 78 ms
15,180 KB
testcase_03 AC 1,684 ms
53,720 KB
testcase_04 AC 1,114 ms
40,256 KB
testcase_05 AC 77 ms
15,136 KB
testcase_06 AC 1,641 ms
53,980 KB
testcase_07 AC 1,112 ms
40,364 KB
testcase_08 AC 368 ms
22,716 KB
testcase_09 AC 605 ms
28,548 KB
testcase_10 AC 84 ms
15,420 KB
testcase_11 AC 80 ms
15,152 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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