結果

問題 No.49 算数の宿題
ユーザー yocto_sothothyocto_sothoth
提出日時 2020-11-22 23:44:16
言語 Ruby
(3.3.0)
結果
AC  
実行時間 87 ms / 5,000 ms
コード長 226 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 11,352 KB
実行使用メモリ 15,280 KB
最終ジャッジ日時 2023-08-24 17:48:53
合計ジャッジ時間 1,708 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
15,108 KB
testcase_01 AC 86 ms
15,032 KB
testcase_02 AC 82 ms
15,128 KB
testcase_03 AC 85 ms
15,156 KB
testcase_04 AC 82 ms
15,152 KB
testcase_05 AC 81 ms
15,040 KB
testcase_06 AC 85 ms
15,224 KB
testcase_07 AC 82 ms
15,084 KB
testcase_08 AC 82 ms
15,280 KB
testcase_09 AC 83 ms
15,264 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s = gets.chomp

arr = s.each_char.chunk { |e| e.match?(/[*+]/) }.map { |bool, e| bool ? e[0] : e.join }

until arr.size == 1
  a, op, b = arr.shift(3)
  op.tr!('*+', '+*')
  arr.unshift(eval([a, op, b].join))
end

puts arr[0]
0