結果
問題 | No.82 市松模様 |
ユーザー |
|
提出日時 | 2016-12-26 19:14:36 |
言語 | OCaml (5.2.1) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,147 bytes |
コンパイル時間 | 174 ms |
コンパイル使用メモリ | 17,536 KB |
最終ジャッジ日時 | 2024-11-14 19:55:21 |
合計ジャッジ時間 | 638 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
File "Main.ml", line 9, characters 2-13: 9 | Stream.iter (fun x -> result := f !result x) stream; ^^^^^^^^^^^ Error: Unbound module Stream
ソースコード
let readln_t3_str () =let ( @@ ) lst n = List.nth lst n inread_line () |>Str.split (Str.regexp_string " ") |>fun lst -> (lst @@ 0, lst @@ 1, lst @@ 2)let stream_fold f stream init =let result = ref init inStream.iter (fun x -> result := f !result x) stream;!resultlet stream_concat sep str_st =match Stream.peek str_st with| None -> ""| Some(_) ->let result = ref (Stream.next str_st) inStream.iter (fun str -> result := !result ^ sep ^ str) str_st;!resultlet solve w h c =let c_arr = if c = "B" then [| "B"; "W"; |]else [| "W"; "B"; |]inlet make_line y =let ymod2 = y mod 2 inlet rec make_line' x result =if x >= w then resultelselet c_idx = (x + ymod2) mod 2 inmake_line' (x + 1) (result ^ c_arr.(c_idx))inmake_line' 0 ""inlet line_st =Stream.from (fun y -> if y >= h then None else Some(make_line y))instream_concat "\n" line_stlet () =let w, h, c = readln_t3_str () |>fun (t1, t2, t3) -> (int_of_string t1, int_of_string t2, t3)insolve w h c |> print_endline