結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー Michae'Gon
提出日時 2015-04-22 18:27:34
言語 Haskell
(9.14.1 + ACL)
コンパイル:
ghc -rtsopts -with-rtsopts=-K1G -o a.out -O2 _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 5,000 ms
+ 279µs
コード長 372 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,330 ms
コンパイル使用メモリ 197,888 KB
実行使用メモリ 9,916 KB
最終ジャッジ日時 2026-09-27 16:33:42
合計ジャッジ時間 7,012 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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

ソースコード

diff #
raw source code

main = getContents >>= print . solve . map read . lines

solve :: [Int] -> Int
solve [x, y, l] = a + b + c + d + e
        where
        a = div (abs x) l + if mod (abs x) l == 0 then 0 else 1
        b = div (abs y) l + if mod (abs y) l == 0 then 0 else 1
        c = if y < 0 then 1 else 0
        d = if x == 0 then 0 else 1
        e = if x == 0 && y < 0 then 1 else 0
0