結果

問題 No.82 市松模様
ユーザー dsplitdsplit
提出日時 2019-08-14 17:07:37
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 4,253 ms
コンパイル使用メモリ 164,728 KB
実行使用メモリ 5,296 KB
最終ジャッジ日時 2023-10-19 18:11:22
合計ジャッジ時間 3,247 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,184 KB
testcase_02 AC 2 ms
5,184 KB
testcase_03 AC 3 ms
5,184 KB
testcase_04 AC 3 ms
5,288 KB
testcase_05 WA -
testcase_06 AC 2 ms
5,256 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 3 ms
5,296 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Data.List
import Control.Monad

f :: String -> Char
f "W" = 'B'
f "B" = 'W'
f  _  = '@'

g :: String -> Char
g "W" = 'W'
g "B" = 'B'
g  _  = '@'

main :: IO ()
main = do
    [a, b, c] <- words <$> getLine
    let w = (read :: String -> Int) a
        h = (read :: String -> Int) b
    forM_ [1..h] $ \i -> do
        if i `mod` 2 == 1
            then putStrLn $ intersperse (f c) $ replicate ((w + 1) `div` 2) (g c)
            else putStrLn $ intersperse (g c) $ replicate ((w + 1) `div` 2) (f c)
0