結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,032 KB
testcase_01 AC 84 ms
15,224 KB
testcase_02 AC 81 ms
15,088 KB
testcase_03 AC 851 ms
53,604 KB
testcase_04 AC 570 ms
40,644 KB
testcase_05 AC 79 ms
15,112 KB
testcase_06 AC 842 ms
53,756 KB
testcase_07 AC 573 ms
40,644 KB
testcase_08 AC 218 ms
22,648 KB
testcase_09 AC 330 ms
28,724 KB
testcase_10 AC 82 ms
15,296 KB
testcase_11 AC 79 ms
15,276 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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