結果

問題 No.10 +か×か
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-02-21 00:07:29
言語 Ruby
(3.3.0)
結果
AC  
実行時間 951 ms / 5,000 ms
コード長 210 bytes
コンパイル時間 36 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 50,944 KB
最終ジャッジ日時 2024-05-08 11:44:28
合計ジャッジ時間 5,093 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
12,032 KB
testcase_01 AC 97 ms
12,160 KB
testcase_02 AC 95 ms
12,288 KB
testcase_03 AC 951 ms
50,944 KB
testcase_04 AC 644 ms
37,376 KB
testcase_05 AC 96 ms
12,032 KB
testcase_06 AC 943 ms
50,816 KB
testcase_07 AC 647 ms
37,376 KB
testcase_08 AC 245 ms
19,456 KB
testcase_09 AC 373 ms
25,600 KB
testcase_10 AC 95 ms
12,160 KB
testcase_11 AC 93 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

gets
t=gets.to_i
a=gets.split.map &:to_i
d=(0..n=a.size-1).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]];print f ??+:?*;x=f ?y:x*a[i]}
0