結果

問題 No.279 木の数え上げ
ユーザー maimai8maimai8
提出日時 2020-08-02 17:19:40
言語 OCaml
(5.1.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 486 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 21,576 KB
実行使用メモリ 64,220 KB
最終ジャッジ日時 2024-04-17 09:08:06
合計ジャッジ時間 3,155 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 253 ms
58,712 KB
testcase_11 AC 39 ms
15,832 KB
testcase_12 AC 155 ms
42,048 KB
testcase_13 AC 20 ms
10,632 KB
testcase_14 MLE -
testcase_15 AC 223 ms
54,388 KB
testcase_16 AC 192 ms
48,992 KB
testcase_17 AC 258 ms
58,792 KB
testcase_18 AC 106 ms
32,584 KB
testcase_19 AC 252 ms
59,248 KB
testcase_20 AC 278 ms
62,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let () =
  let rec charlist_of_string str n i =
    if i = n then []
    else str.[i] :: charlist_of_string str n (i+1) in
  let rec count lst target =
    List.length (List.filter (fun x -> x = target) lst) in
  Scanf.scanf "%s\n" @@ fun s ->
  let lst = charlist_of_string s (String.length s) 0 in
  let t = count lst 't' in
  let r = count lst 'r' in
  let e = count lst 'e' in
  Printf.printf "%d\n"
    (if t < r && t * 2 <= e then t else if r <= t && r * 2 <= e then r else e / 2)
0