結果
問題 | No.82 市松模様 |
ユーザー |
|
提出日時 | 2019-04-04 11:54:37 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 480 bytes |
コンパイル時間 | 1,601 ms |
コンパイル使用メモリ | 174,720 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 18:15:43 |
合計ジャッジ時間 | 2,188 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 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
ソースコード
main = getLine >>= mapM putStrLn . solve . (\[w, h, c] -> (map read [w, h], c)) . wordssolve::IntString->Stringsolve ([w, h], c) = reverse $ f h whered = if c == "B" then "W" else "B"w2 = div w 2cd = concat $ zipWith (++) (replicate w2 c) (replicate w2 d)dc = reverse cdoddL = if odd w then cd ++ c else cdevenL = if odd w then dc ++ d else dcf 0 = []f i | odd i = oddL : f (i - 1)| otherwise = evenL : f (i - 1)