結果

問題 No.131 マンハッタン距離
ユーザー momen999momen999
提出日時 2017-04-25 14:23:01
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 305 bytes
コンパイル時間 1,541 ms
コンパイル使用メモリ 153,704 KB
実行使用メモリ 7,176 KB
最終ジャッジ日時 2023-10-11 09:33:45
合計ジャッジ時間 1,675 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,096 KB
testcase_01 AC 2 ms
6,928 KB
testcase_02 AC 2 ms
6,936 KB
testcase_03 AC 2 ms
7,088 KB
testcase_04 AC 2 ms
7,076 KB
testcase_05 AC 2 ms
7,084 KB
testcase_06 AC 2 ms
7,040 KB
testcase_07 AC 2 ms
7,048 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 WA -
testcase_10 AC 2 ms
7,148 KB
testcase_11 AC 2 ms
7,092 KB
testcase_12 WA -
testcase_13 AC 3 ms
7,080 KB
testcase_14 AC 2 ms
7,100 KB
testcase_15 AC 2 ms
7,076 KB
testcase_16 AC 2 ms
7,100 KB
testcase_17 AC 2 ms
7,156 KB
testcase_18 AC 2 ms
7,100 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
7,148 KB
testcase_22 AC 3 ms
7,096 KB
testcase_23 AC 2 ms
7,104 KB
testcase_24 AC 2 ms
7,092 KB
testcase_25 AC 2 ms
7,140 KB
testcase_26 AC 2 ms
7,060 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

solve [x,y,d]
    | d == 0            = 1
    | m < d             = 0
    | x < d || y < d    = m - d + 1
    | otherwise         = d + 1
    where
        m = (abs x) + (abs y)   -- マンハッタン距離

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