結果

問題 No.48 ロボットの操縦
ユーザー tonyu0
提出日時 2020-03-24 22:31:55
言語 Haskell
(9.10.1)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 306 bytes
コンパイル時間 15,165 ms
コンパイル使用メモリ 177,664 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-01 18:38:29
合計ジャッジ時間 2,102 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.10.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

main :: IO ()
main = do
  a <- readLn
  b <- readLn
  c <- readLn
  print $ solve a b c

solve :: Integer -> Integer -> Integer -> Integer

solve a b c = div (abs a + c - 1) c + d + div (abs b + c - 1) c + e
  where d = if a /= 0 then 1 else 0
        e = if b < 0 then 1  + if a == 0 then 1 else 0 else 0
0