結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-11 23:29:37 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 416 bytes |
| コンパイル時間 | 8,273 ms |
| コンパイル使用メモリ | 173,696 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 10:17:07 |
| 合計ジャッジ時間 | 9,106 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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
ソースコード
module Main where
import Control.Monad
rotate :: Int -> Int -> Int
rotate 0 y
| y >= 0 = 0
rotate x y
| y >= 0 = 1
| otherwise = 2
move :: Int -> Int -> Int
move _ 0 = 0
move dt n
| r == 0 = q
| otherwise = q + 1
where
(q, r) = (abs n) `divMod` dt
main :: IO ()
main = do
x <- readLn :: IO Int
y <- readLn
dt <- readLn
print $ rotate x y + move dt x + move dt y