結果
問題 | No.193 筒の数式 |
ユーザー | gemmaro |
提出日時 | 2020-05-07 09:12:39 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 86 ms / 1,000 ms |
コード長 | 394 bytes |
コンパイル時間 | 292 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-07-03 09:18:08 |
合計ジャッジ時間 | 2,534 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
コンパイルメッセージ
Syntax OK
ソースコード
# frozen_string_literal: true def solve (0..(S.size - 1)).map do |i| s = S.chars.rotate(i).join # rubocop:todo Security/Eval s.stem? ? [(eval s.gsub(/0+(\d+)/) { Regexp.last_match(1) })] : [] # rubocop:enable Security/Eval end.reduce(:+).max end class String # rubocop:todo Style/Documentation def stem? match?(/^[^+-].*[^+-]$/) end end S = gets.chomp puts solve