結果

問題 No.193 筒の数式
ユーザー gemmarogemmaro
提出日時 2020-05-07 08:59:59
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 314 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 11,328 KB
実行使用メモリ 15,344 KB
最終ジャッジ日時 2023-09-16 07:43:39
合計ジャッジ時間 3,108 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,120 KB
testcase_01 WA -
testcase_02 AC 80 ms
15,288 KB
testcase_03 AC 82 ms
15,124 KB
testcase_04 AC 80 ms
15,288 KB
testcase_05 AC 80 ms
15,164 KB
testcase_06 AC 80 ms
15,292 KB
testcase_07 AC 78 ms
15,132 KB
testcase_08 AC 79 ms
15,124 KB
testcase_09 AC 79 ms
15,172 KB
testcase_10 AC 79 ms
15,160 KB
testcase_11 AC 78 ms
15,088 KB
testcase_12 AC 78 ms
15,032 KB
testcase_13 AC 80 ms
15,324 KB
testcase_14 AC 79 ms
15,228 KB
testcase_15 AC 80 ms
15,096 KB
testcase_16 AC 79 ms
15,124 KB
testcase_17 AC 80 ms
15,332 KB
testcase_18 AC 80 ms
15,036 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

def solve
  (0..(S.size - 1)).map do |i|
    s = S.chars.rotate(i).join
    s.stem? ? [(eval s)] : [] # rubocop:todo Security/Eval
  end.reduce(:+).max
end

class String # rubocop:todo Style/Documentation
  def stem?
    match?(/^[^+-].*[^+-]$/)
  end
end

S = gets.chomp

puts solve
0