結果

問題 No.717 ファッションへのこだわり
ユーザー ichibanshiboriichibanshibori
提出日時 2018-09-15 19:43:08
言語 OCaml
(5.1.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 20,864 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-17 08:44:20
合計ジャッジ時間 866 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 3 ms
6,940 KB
testcase_08 AC 4 ms
6,940 KB
testcase_09 AC 4 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 3 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

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