Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let _ =
- let sb = Scanf.Scanning.stdib in
- let n = Scanf.bscanf sb "%d " (fun s -> s) in
- let w = ref 1 in
- let h = ref 1 in
- for i = 1 to n do
- let s = Scanf.bscanf sb "%s " (fun s -> s) in
- match s with
- | "UL" ->
- incr h
- | "UR" ->
- incr w
- | "DL" ->
- incr w
- | "DR" ->
- incr h
- | "ULDR" ->
- incr h;
- incr w;
- | _ -> assert false
- done;
- let res = Int64.mul (Int64.of_int !h) (Int64.of_int !w) in
- Printf.printf "%Ld\n" res
Add Comment
Please, Sign In to add comment