結果
| 問題 | 
                            No.193 筒の数式
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-05-07 08:59:59 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 314 bytes | 
| コンパイル時間 | 39 ms | 
| コンパイル使用メモリ | 7,424 KB | 
| 実行使用メモリ | 12,416 KB | 
| 最終ジャッジ日時 | 2024-07-03 09:17:45 | 
| 合計ジャッジ時間 | 2,418 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 15 WA * 1 | 
コンパイルメッセージ
Syntax OK
ソースコード
# 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