結果

問題 No.193 筒の数式
ユーザー pekempeypekempey
提出日時 2015-04-26 22:28:07
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 337 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 11,444 KB
実行使用メモリ 15,304 KB
最終ジャッジ日時 2023-09-18 12:02:45
合計ジャッジ時間 3,435 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,216 KB
testcase_01 WA -
testcase_02 AC 78 ms
15,064 KB
testcase_03 AC 79 ms
15,064 KB
testcase_04 AC 79 ms
15,032 KB
testcase_05 AC 78 ms
15,108 KB
testcase_06 AC 78 ms
15,228 KB
testcase_07 AC 79 ms
15,240 KB
testcase_08 AC 79 ms
15,276 KB
testcase_09 AC 78 ms
15,220 KB
testcase_10 AC 78 ms
15,188 KB
testcase_11 AC 78 ms
15,088 KB
testcase_12 AC 77 ms
15,056 KB
testcase_13 AC 78 ms
15,244 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

str = gets

ans = 0

(0..str.length-2).each {|i|
    left = str[0..i]
    right = str[(i+1)..(str.length-2)]
    expr = right + left

    if expr[0] == '+' || expr[-1] == '+'
        next
    end

    if expr[0] == '-' || expr[-1] == '-'
        next
    end

    val = eval(expr)

    if val > ans
        ans = val
    end
}

puts ans
0