結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2015-01-30 21:58:19 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 347 bytes |
| コンパイル時間 | 7,478 ms |
| コンパイル使用メモリ | 177,656 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-10 18:24:26 |
| 合計ジャッジ時間 | 8,430 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main ( Main.hs, Main.o )
Main.hs:4:1: warning: [GHC-94817] [-Wtabs]
Tab character found here, and in 12 further locations.
Suggested fix: Please use spaces instead.
|
4 | if abs(a-s) <= abs(b-s)
| ^^^^^^^^
[2 of 2] Linking a.out
ソースコード
f :: Int -> Int -> Int -> Int f a b 1 = abs(a-1) + abs(1-0) f a b s = do if abs(a-s) <= abs(b-s) then abs(a-s) + abs(s-0) else if a>0 then min ( abs(b-s) + abs(a-s) + (f a a a) ) ( abs(s-b) + abs(s-1) + (f a 1 1) ) else abs(s-b) + abs(s-1) + (f a 1 1) main = do [a,b,s] <- (map read . words) `fmap` getLine putStrLn $ show $ f a b s
koyumeishi