結果

問題 No.82 市松模様
ユーザー momen999momen999
提出日時 2019-04-04 11:37:06
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 471 bytes
コンパイル時間 6,482 ms
コンパイル使用メモリ 162,380 KB
実行使用メモリ 7,364 KB
最終ジャッジ日時 2023-08-26 17:35:01
合計ジャッジ時間 7,087 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,008 KB
testcase_01 WA -
testcase_02 AC 3 ms
7,120 KB
testcase_03 AC 2 ms
7,028 KB
testcase_04 WA -
testcase_05 AC 2 ms
7,252 KB
testcase_06 AC 2 ms
7,136 KB
testcase_07 AC 2 ms
7,236 KB
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

main = getLine >>= mapM putStrLn . solve . (\[w, h, c] -> (map read [w, h], c)) . words

solve :: ([Int], String) -> [String]
solve ([w, h], c) = f h where
    d = if c == "B" then "W" else "B"
    w2 = div w 2
    cd = concat $ zipWith (++) (replicate w2 c) (replicate w2 d)
    dc = reverse cd
    oddL = if odd w then cd ++ c else cd
    evenL = if odd w then dc ++ d else dc
    f 0 = []
    f i | odd i     = oddL : f (i - 1)
        | otherwise = evenL : f (i - 1)
0