結果

問題 No.131 マンハッタン距離
ユーザー momen999
提出日時 2017-04-25 13:37:05
言語 Haskell
(9.10.1)
結果
WA  
実行時間 -
コード長 365 bytes
コンパイル時間 2,629 ms
コンパイル使用メモリ 172,288 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 08:42:57
合計ジャッジ時間 2,763 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

getSmall x y = if x < y then x else y

solve [x,y,d]
    | d == 0            = 1
    | x < d && y < d    = 0
    | x' == y'          = x' + 1
    | otherwise         = ans + 1
    where
        x' = getSmall x d
        y' = getSmall y d
        ans = getSmall x' y'

main = do
    xyd <- map (abs . read :: String -> Int) . words <$> getLine
    print $ solve xyd
0