結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-29 19:20:33 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 356 bytes |
| コンパイル時間 | 6,784 ms |
| コンパイル使用メモリ | 176,256 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 16:03:06 |
| 合計ジャッジ時間 | 2,741 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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
ソースコード
ceilDiv :: Integral a => a -> a -> a
ceilDiv t s = (t + s - 1) `div` s
solve :: Int -> Int -> Int -> Int
solve x y l = ceilDiv (abs x) l + ceilDiv (abs y) l + t
where
t | y < 0 = 2
| x /= 0 = 1
| otherwise = 0
main :: IO ()
main = do
x <- readLn :: IO Int
y <- readLn :: IO Int
l <- readLn :: IO Int
print $ solve x y l