結果
| 問題 |
No.193 筒の数式
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-27 22:11:11 |
| 言語 | Ruby (3.4.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 257 bytes |
| コンパイル時間 | 179 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,544 KB |
| 最終ジャッジ日時 | 2024-11-24 04:57:24 |
| 合計ジャッジ時間 | 2,347 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 RE * 1 |
コンパイルメッセージ
Syntax OK
ソースコード
s = gets.chomp
rmax = eval(s)
n = s.length
1.upto(n-1) do |i|
exp = s[i..(n-1)] + s[0..(i-1)]
next if '+-'.include?(exp[0])
next if '+-'.include?(exp[-1])
exp.gsub!(/(?:^|([+-]))[0]+(\d+)/o){|_| $1+$2 }
rmax = [rmax, eval(exp)].max
end
puts rmax