結果
問題 | No.10 +か×か |
ユーザー | らっしー(raccy) |
提出日時 | 2015-01-30 21:49:02 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 610 bytes |
コンパイル時間 | 101 ms |
コンパイル使用メモリ | 11,248 KB |
実行使用メモリ | 15,348 KB |
最終ジャッジ日時 | 2023-09-05 08:25:07 |
合計ジャッジ時間 | 8,064 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 84 ms
15,348 KB |
testcase_01 | AC | 87 ms
15,312 KB |
testcase_02 | AC | 86 ms
15,028 KB |
testcase_03 | AC | 189 ms
15,028 KB |
testcase_04 | TLE | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
コンパイルメッセージ
Main.rb:26: warning: assigned but unused variable - n Syntax OK
ソースコード
def calc(total, current, list, point) if point == list.size if total == current return "" else return nil end end # + next_current = current + list[point] if next_current <= total if next_calc = calc(total, next_current, list, point + 1) return "+" + next_calc end end # * next_current = current * list[point] if next_current <= total if next_calc = calc(total, next_current, list, point + 1) return "*" + next_calc end end return nil end n = gets.to_i total = gets.to_i list = gets.split.map &:to_i puts calc(total, list[0], list, 1)