結果
| 問題 | 
                            No.126 2基のエレベータ
                             | 
                    
| コンテスト | |
| ユーザー | 
                            👑  | 
                    
| 提出日時 | 2019-05-02 08:56:41 | 
| 言語 | Lua  (LuaJit 2.1.1734355927)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 235 bytes | 
| コンパイル時間 | 341 ms | 
| コンパイル使用メモリ | 6,816 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-12-31 13:09:50 | 
| 合計ジャッジ時間 | 1,348 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 WA * 8 | 
ソースコード
local a, b, s = io.read("*n", "*n", "*n")
if(s == 1) then
  print(math.abs(a - 1) + 1)
else
  if(math.abs(a - s) <= math.abs(b - s)) then
    print(math.abs(a - s) + s)
  else
    print(math.abs(b - s) + math.abs(a - s) + a)
  end
end