結果
問題 | No.10 +か×か |
ユーザー | letrangerjp |
提出日時 | 2017-05-14 16:58:14 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 446 bytes |
コンパイル時間 | 331 ms |
コンパイル使用メモリ | 11,392 KB |
実行使用メモリ | 19,604 KB |
最終ジャッジ日時 | 2023-10-14 10:57:58 |
合計ジャッジ時間 | 7,823 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 82 ms
15,300 KB |
testcase_01 | AC | 82 ms
15,148 KB |
testcase_02 | AC | 81 ms
15,168 KB |
testcase_03 | AC | 657 ms
15,400 KB |
testcase_04 | TLE | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
コンパイルメッセージ
Syntax OK
ソースコード
def f(a, total) r = [] g = lambda{|res, idx| return false if res > total return res == total if idx == a.size [:+, :*].each{|op| new_res = res.send(op, a[idx]) next if new_res > total r << op if g.(new_res, idx+1) return true end r.pop } false } first = a.shift g.(first, 0) r end N = gets.to_i Total = gets.to_i A = gets.split.take(N).map(&:to_i) puts f(A, Total)*""