結果
| 問題 | No.48 ロボットの操縦 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-11 23:29:37 |
| 言語 | Haskell (9.14.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 416 bytes |
| 記録 | |
| コンパイル時間 | 894 ms |
| コンパイル使用メモリ | 198,532 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-10 12:41:02 |
| 合計ジャッジ時間 | 1,811 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/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