結果

問題 No.126 2基のエレベータ
ユーザー okadukiokaduki
提出日時 2015-01-16 23:20:44
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 320 bytes
コンパイル時間 12,517 ms
コンパイル使用メモリ 166,412 KB
実行使用メモリ 7,368 KB
最終ジャッジ日時 2023-09-04 13:41:26
合計ジャッジ時間 14,189 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 3 ms
7,288 KB
testcase_03 AC 3 ms
7,192 KB
testcase_04 AC 3 ms
7,248 KB
testcase_05 AC 3 ms
7,148 KB
testcase_06 AC 3 ms
7,260 KB
testcase_07 WA -
testcase_08 AC 3 ms
7,152 KB
testcase_09 AC 3 ms
7,216 KB
testcase_10 AC 3 ms
7,200 KB
testcase_11 AC 3 ms
7,084 KB
testcase_12 WA -
testcase_13 AC 3 ms
7,268 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 3 ms
7,180 KB
testcase_18 AC 2 ms
7,260 KB
testcase_19 AC 3 ms
7,216 KB
testcase_20 WA -
testcase_21 AC 2 ms
7,288 KB
testcase_22 AC 3 ms
7,252 KB
testcase_23 AC 3 ms
7,288 KB
testcase_24 AC 3 ms
7,148 KB
testcase_25 AC 3 ms
7,260 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Applicative
import Text.Printf

main = do
  xs <- fmap (read :: String -> Int) . words <$> getLine
  printf "%d\n" $ solve xs
  where
    solve (a:b:s:_)
      | s == 1 = abs (a - 1) + 1
      | otherwise = if abs (s-a) <= abs (s-b) then abs (s-a) + s
                      else abs (s-b) + abs (a-b) + a
0