結果
問題 | No.617 Nafmo、買い出しに行く |
ユーザー |
![]() |
提出日時 | 2018-03-11 19:13:59 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 346 ms / 2,000 ms |
コード長 | 268 bytes |
コンパイル時間 | 37 ms |
コンパイル使用メモリ | 7,168 KB |
実行使用メモリ | 12,160 KB |
最終ジャッジ日時 | 2024-10-15 00:21:39 |
合計ジャッジ時間 | 4,684 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
コンパイルメッセージ
Main.rb:15: warning: assigned but unused variable - n Syntax OK
ソースコード
def f(sum,xs,m)return 0 if (sum>m)if(xs.empty? == true)return sumelsee=xs.shiftres=0res=f(sum,xs,m)res=[res,f(sum+e,xs,m)].maxxs.unshift(e)return resendendn,m=gets.split.map{|e| e.to_i}xs=STDIN.read.split.map{|e| e.to_i}puts f(0,xs,m)