結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2016-07-19 19:11:23 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 554 bytes |
コンパイル時間 | 3,552 ms |
コンパイル使用メモリ | 176,384 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 18:44:31 |
合計ジャッジ時間 | 4,348 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
main = dox <- readLny <- readLnl <- readLnprint $ compute x y lcompute::Int->Int->Int->Int{-compute x y l = inner (compare y 0) (compare x 0) whereinner GT EQ = ylinner GT _ = yl + 1 + xlinner LT EQ = 2 + ylinner LT _ = 1 + xl + 1 + ylinner EQ EQ = 0inner EQ _ = 1 + xlxl = steps x lyl = steps y l-}compute x y l =if y < 0 then xl + yl + 2 elseif x == 0 then yl else xl + yl + 1wherexl = steps x lyl = steps y lsteps x l = let (p,q) = divMod (abs x) l in if q == 0 then p else p+1