結果

問題 No.717 ファッションへのこだわり
ユーザー ichibanshibori
提出日時 2018-09-15 19:43:08
言語 OCaml
(5.2.1)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 00:31:32
合計ジャッジ時間 801 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

let countAB str =
  let len_str = String.length str in
  let str_lst = Array.init len_str (fun i -> str.[i]) |> Array.to_list in
  List.partition (fun c -> c = 'A') str_lst
  |> fun (aLst, bLst) -> (List.length aLst, List.length bLst)

let solve s t =
  let a1, b1 = countAB s
  and a2, b2 = countAB t in
  (min a1 a2) + (min b1 b2)

let () =
  let _ = read_line ()
  and s = read_line ()
  and t = read_line () in
  solve s t
  |> Printf.printf "%d\n"
0