結果
| 問題 |
No.249 N言っちゃダメゲーム (2)
|
| コンテスト | |
| ユーザー |
r6eve
|
| 提出日時 | 2017-08-16 13:59:40 |
| 言語 | OCaml (5.2.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 739 bytes |
| コンパイル時間 | 387 ms |
| コンパイル使用メモリ | 20,992 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-09 00:21:10 |
| 合計ジャッジ時間 | 1,511 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 1 RE * 2 |
ソースコード
module IO = struct
(* @since 4.04.0 *)
let split_on_char sep s =
let open String in
let r = ref [] in
let j = ref (length s) in
for i = length s - 1 downto 0 do
if get s i = sep then begin
r := sub s (i + 1) (!j - i - 1) :: !r;
j := i
end
done;
sub s 0 !j :: !r
let read_ss () = read_line () |> split_on_char ' '
let read_ns () = read_ss () |> List.map int_of_string
end
let () =
let rec doit i first_p s =
if i = 1000 then s
else
match IO.read_ns () with
| [n; k] ->
let x = if k = n - 1 then 1 else 0 in
doit (i + 1) (not first_p) (s + if first_p then x else 1 - x)
| _ -> assert false in
doit 0 true 0 |> Printf.printf "%d\n"
r6eve